[solved] Alternative to QWindow for OpenGL API?
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).
Comment: perhaps I could use QGraphicsScene/QGraphicsView?
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/
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.
Thank you very much, I appreciate it.