Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [solved] Alternative to QWindow for OpenGL API?

    General and Desktop
    3
    4
    4089
    Loading More Posts
    • 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
      maissiou23 last edited by

      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 Reply Quote 0
      • martin_ky
        martin_ky last edited by

        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 Reply Quote 0
        • Z
          ZapB last edited by

          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 Reply Quote 0
          • M
            maissiou23 last edited by

            Thank you very much, I appreciate it.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post