Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Sharing between QGLContext and QOpenGLContext
wrosecrans last edited by
So, I have an instance of a subclass of QGLWidget, "viewport." I also have a "compositor" with a QOffscreenSurface, a QOpenGLContext and a QOpenGLFrameBufferObject. I want to draw in my viewport using the FBO as a texture. The compositor needs to be able to create its own OpenGL context so that it works regardless of whether the viewer exists or is active. (The app has a "render only" mode where no visible GUI stuff is displayed -- it just writes a file. The viewport is only for interactive mode.)
QGLWidget::context() gets me a QGLContext, which I want to share with the QOpenGLContext. Is this the correct way to do it?
Are there any gotchas related to sharing state between the two sorts of contexts that I should know about? Can I expect this to be portable between platforms?