Retrive QML's QOpenGL context
-
Hi,
I want to create a secondary OpenGL context shared with QML's
QOpenGLContextto do background texture/mesh loading then rendering these assets in aQQuickFramebufferObjectwith QML's OpenGL context.Problem is I can't find a "clean" way to retrieve QML's OpenGL context.
The only way I found right now is to have a
BackgroundLoaderclass inherinting fromQQuickPaintedItem, use it somewhere in QML, then wait for apaintcall to retrieve the bound context usingQOpenGLContext::currentContext(). After retrieving it, I can then create my secondary context. This feels like a hack and not the correct way to handle this (it does not work if my item is not rendered (size of 0)).Is there a way to retrieve QML's OpenGL context from C++ easily ? (I have access to the
QQmlEngineand to aQQuickItemthat I use to manage my 3D views). I don't need it to be bound. Just get a pointer to it to share it with my secondary context.Thanks
-
Hi,
I want to create a secondary OpenGL context shared with QML's
QOpenGLContextto do background texture/mesh loading then rendering these assets in aQQuickFramebufferObjectwith QML's OpenGL context.Problem is I can't find a "clean" way to retrieve QML's OpenGL context.
The only way I found right now is to have a
BackgroundLoaderclass inherinting fromQQuickPaintedItem, use it somewhere in QML, then wait for apaintcall to retrieve the bound context usingQOpenGLContext::currentContext(). After retrieving it, I can then create my secondary context. This feels like a hack and not the correct way to handle this (it does not work if my item is not rendered (size of 0)).Is there a way to retrieve QML's OpenGL context from C++ easily ? (I have access to the
QQmlEngineand to aQQuickItemthat I use to manage my 3D views). I don't need it to be bound. Just get a pointer to it to share it with my secondary context.Thanks