Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Sharing data between an offscreen QGLContext and a QGLWidget



  • I seem to be having a minor dilemma... It would seem that the ability to create offscreen QGLContexts has been deprecated:

    http://qt-project.org/doc/qt-4.8/qglcontext-obsolete.html

    You can no longer specify a paint device without using this obsolete constructor. It would seem that in the future, QGLContext will not be something you construct in your own code. However, if I don't construct my own QGLContext, I can't share with an offscreen QGLContext and an onscreen QGLWidget, as QGLWidget's constructor only accepts a share widget (QGLWidget) and the only way to specify a context to share with is via QGLWidget's setContext. There are so many different conflicting concepts that I am now dumbfounded and have absolutely no idea what I'm supposed to do. For the record, using the obsolete constructor works, and not specifying paint device leads to a create failure.

    Summary: I want to have an offscreen QGLContext to share data with my QGLWidget. What is the 'correct' and current way to do this?

    Thanks.



  • Alright, since it seems to remain unknown the 'correct' way to do off-screen contexts now, I have just resolved to using QGLContext's deprecated functionality. I have also decided to drop QGLWidget and instead use QGLContext manually, using a regular QWidget as a paint device for on screen contexts, which solves the problems I was having.

    I will probably need completely different code in Qt 5, but for now this works. Any suggestions are still welcome.


Log in to reply