Proper way to create an OpenGL Widget since Qt 5 ?
-
Hi,
The new proper way to create opengl context seems to be to derivate QWindow and QOpenGLFunctions, and use setSurfaceType(OpenGLSurface) and initializeOpenGLFunctions().
(as described in qthelp://org.qt-project.qtgui.520/qtgui/qtgui-openglwindow-example.html )But that's for a window. My application use several opengl widgets inside a QSplitter container.
What's the new proper way to do that ? I used to use QGLWidget, but "QGL" class seems to be deprecated in favor of the new "QOpenGL" class. And I can't setSurfaceType of a QWidget...Thanks
-
AFAIK, a proper "next-gen" QGLWidget is in the making, but not ready yet (maybe it will be available in Qt 5.3 or 5.4, depending on how much time does Sean have to work on this).
-
You could use QWidget::createWindowContainer(). See http://blog.qt.digia.com/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer/
Not sure how well it would work with QSplitter with regards to performance when resizing, but it's probably worth a try.