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. [solved] Alternative to QWindow for OpenGL API?
QtWS25 Last Chance

[solved] Alternative to QWindow for OpenGL API?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 4.2k 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.
  • M Offline
    M Offline
    maissiou23
    wrote on last edited by
    #1

    Hi,

    I saw that in the "Qt 5.0 QWindow class Documentation":http://doc-snapshot.qt-project.org/5.0/qtgui/qwindow.html it says:

    bq. An application will typically use QWidget or QQuickView for its UI, and not QWindow directly. Still, it is possible to render directly to a QWindow with QBackingStore or QOpenGLContext, when wanting to keep dependencies to a minimum or when wanting to use OpenGL directly. The Raster Window and OpenGL Window examples are useful reference examples for how to render to a QWindow using either approach.

    Is there an alternative to QWindow to use with OpenGL >4.1?

    I intend to use that display window as a central widget of a QMainWindow. Can QGLWidget be used with OpenGL >4.1, and if yes, will QGLWidget class be supported in Qt 5?

    I am trying to avoid QWindow as it can't be set as a central widget in a QMainWindow and it seems to be a lightweight version of QMainWindow which inherits from QWidget (while QWindow inherits from QObject).

    -Thanks.

    Comment: perhaps I could use QGraphicsScene/QGraphicsView?

    1 Reply Last reply
    0
    • martin_kyM Offline
      martin_kyM Offline
      martin_ky
      wrote on last edited by
      #2

      Hello maissiou23,

      It seems you can use any version of OpenGL with QGLWidget in Qt5. However I believe it will not receive much attention from the developers in the future. If your focus is mainly openGL graphics and don't need widgets, you will be better with QWindow and QOpenGL* family of helper classes.

      They are introducing way to mix QWindow with QWidget based UI in the upcoming Qt 5.1. Take a look at this blog post - http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #3

        Yes Qt5 is usable with any new version of OpenGL up to and including OpenGL 4.3. YOu can use QGLWidget directly or you can use QWindow + QOpenGLContext and QWidget::createWindowContainer() as martin_ky mentioned.

        If you do use QGLWidget, then I would recommend that you use QOpenGLShaderProgram and friends rather than QGLShaderProgram as the QGL* classes will not see any further development. There is no problem in using QOpenGL* classes with QWidget as under the hood QGLWidget uses QGLCOntext which in turn is implemented in terms of QOpenGLContext.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maissiou23
          wrote on last edited by
          #4

          Thank you very much, I appreciate it.

          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