Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSurfaceFormat Vs. QGLFormat [resolved]
QtWS25 Last Chance

QSurfaceFormat Vs. QGLFormat [resolved]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kloveridge
    wrote on last edited by
    #1

    I see two different OpenGL setup examples and one uses QGLFormat and the QSurfaceFormat. the two classes seem similar. Could someone clarify why these classes seem to be doing similar functions.

    My need is. I have a editor window I want to put a QGLWidget into. There are no two examples that show the same way to set up a openGL window in Qt. Could someone give me some guidance?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chrisaverage
      wrote on last edited by
      #2

      There are different ways to work with OpenGL in Qt. The older one, coming from Qt4 was to use QGLWidget, that in turn uses QGLFormat to set up OpenGL parameters.

      Moving on to Qt5 widgets and windows have been separated and now we can have a QWindow that is not a widget (eg. for QtQuick or native stuff). This QWindow uses QSurface as a rendering surface and it can use OpenGL or other painting mechanisms. The QSurfaceFormat describes that format, and in particular various options of the OpenGL context creation.

      So if you're using widgets you can go with QGLFormat else use the newer classes.

      1 Reply Last reply
      0
      • JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on last edited by
        #3

        Hi,

        [quote author="chrisaverage" date="1410007598"]So if you're using widgets you can go with QGLFormat else use the newer classes.[/quote]Bear in mind that in Qt 5.4, which is scheduled to be released at the "end of October 2014":http://qt-project.org/wiki/Qt-5.4-release, will introduce the new "QOpenGLWidget":http://doc-snapshot.qt-project.org/qt5-5.4/qopenglwidget.html class.

        QOpenGLWidget is designed to replace QGLWidget and it will use QSurfaceFormat. As of Qt 5.4, all classes that are prefixed with "QGL" (including QGLFormat) will be fully deprecated, and their usage will be discouraged.

        I'd suggest starting with QGLWidget + QGLFormat for now, and consider changing over to QOpenGLWidget + QSurfaceFormat when Qt 5.4 arrives (if you upgrade to Qt 5.4, that is)

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kloveridge
          wrote on last edited by
          #4

          Thank you. These answers are very insightful

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved