View Full Version : Multithreaded OpenGL
04-29-2004, 02:59 PM
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?
04-29-2004, 04:41 PM
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!)
05-03-2004, 10:46 AM
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...
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.