[Qt-creator] Sharing GL ctx with qt-designer.

Paulo Silva paulo.jnkml at gmail.com
Tue Jun 19 12:39:13 CEST 2012


Hi everyone,

I have a question wich is more about the qt-designer functionality of
qt-creator, so this might actually be the wrong mailing list - if so,
sorry about that.

My question is how can we share an OGL context between two or more
QGLWidgets, when the interface is made using the design mode?.
That is, since I'm not creating the widgets myself, how can I take the
context of one of the widgets and share it with the other widgets?
I tried to create to create class members like:
static QGLContext* const _shared_context(new QGLContext(QGLFormat()));
static QGLWidget* _shared_widget(initialized to the first widget created...);

and tried to pass it to the constructor,
MyClass():
    QGLWidget(_shared_context, parent, _shared_widget),
{
(...)
}

But it does not seem to work as isSharing returns false, and nothing
updateGL fails drawing nothing.

Is there a correct way of doing this? Any designer functionality?

Thanks
Paulo



More information about the Qt-creator mailing list