Hi,
I'm trying to use multithreads to accelerate the program, and I have to use the QGLContext (Qt 4.7.1) in forked thread, the workable code is like this,
How can I re-write the above code by QGLContext ? I tried like this but error raised.// main thread
HDC hDC = wglGetCurrentDC();
HGLRC hGlobalGLRC = wglGetCurrentContext();
HGLRC hSharedGLRC = wglCreateContext(hDC, hGlobalGLRC); // Create a shared GL context.
DoSomething();
// forked another thread
wglMakeCurrent(hDC, hSharedGLRC);
DoSomething();
Is there anybody tried this ? Thanks !QGLContext *pGlobalGLRC = QGLContext::currentContext();
QGLContext *pSharedGLRC = new QGLContext(pGlobalGLRC->format());
pSharedGLRC->create(pGlobalGLRC); // Always error here !
DoSomething();
// forked another thread
pSharedGLRC->makeCurrent();
DoSomething();
Bookmarks