I have a multithreaded application, I am creating the OpenGL context in one thread, and using it in another. How do I make it so that I can use the context from a thread that I didn’t create it in?
That should Just Work. It’s all the same program, just multiple threads, so the OpenGL state machine shouldn’t care what threads are telling it what, as long as it gets a sensible series of commands.
I’m pretty sure that multiple contexts with one thread each should also pretty much Just Work, but I’m not sure.
The only thing you should have to worry about is two threads trying to talk to the same context at once. (Yea race conditions!)
Endash is right, this should work, you’ve just to share the needed context between threads as a variable…
Special sharing attention is needed when you want to share display list between context (see wglShareLists)
Take care of the fact that opengl is not thread safe, you should be sure to not use opengl at the same time from different threads…