Actually, here is what we have: Our application has a main thread loop. It loads Qt dynamically (because we don't necessarily need it at compile time). Qt doesn't wraps our app. At some point in our main thread, we create a QApplication and widgets. Then, as we did before Qt integration, we load our OpenGL renderer. It creates its own context, may load resources at any time, and currently draws in its own non-Qt window.
But, the simple fact we now have Qt Windows and non-Qt windows with OpenGL at the same time produces glitches in our renderer, and we're trying to solve it. (We do this to keep them independant from each other. In the future we may wrap our renderer window in a QWindow but at the moment we try to make it just work). Here is the kind of code I used to perform sharing, just after we create our custom OpenGL context: // Get the main Qt context Q_ASSERT(qGuiApp); QOpenGLContext * qtContext = qt_gl_global_share_context(); if (qtContext == 0) { // Qt: Global OpenGL context is not available return 0; } #ifdef WIN32 // We get our renderer's OpenGL context HGLRC hOurContext = /* get from somewhere */ HWND hOurWindow = /* get from somewhere */ QWGLNativeContext ourNativeContext(hOurContext, hOurWindow); QOpenGLContext * ourContext = new QOpenGLContext; ourContext->setNativeHandle(QVariant::fromValue(ourNativeContext)); ourContext->setShareContext(qtContext); ourContext->create(); #else However I didn't noticed any difference. Or is this the wrong way to share? Or maybe there is one more problem: we are still single-threaded, so we need to make sure the current OpenGL is the good one when we perform our calls. I said we cannot use the the approaches needing paintGL() and the like, because we would be outside of our main loop, and would lead to side-effects. I also wonder if we can put the Qt main loop in ours, because at the moment we have no clue when it updates...
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest