PDA

View Full Version : OpenGL and Multithread



pango
10-29-2003, 04:38 AM
I create a OpenGL render context in main thread,but how can I render scene to the context in other thread?I'm still finding the documents about the relationship of OpenGL and multithread,anyone can help me?

NitroGL
10-29-2003, 07:06 AM
IIRC, OpenGL contexts can only be used in the original calling thread that it was created in. From the main thread, you could launch a thread that creates the GL context and runs the render loop.

azazello
10-29-2003, 09:06 AM
plain example exist in SGI SDK http://oss.sgi.com/projects/ogl-sample/GLsdk.zip

newt
10-29-2003, 11:19 AM
GL context can only be current in one thread at a time.

So you have to wglMakeCurrent(NULL, NULL);
in the main thread before making your context current in the slave/drawing thread.