[SDL] SDL_thread and OpenGL on OS X

Daniel Bünzli daniel.buenzli at epfl.ch
Sat Apr 28 01:22:22 PDT 2007


Le 28 avr. 07 à 00:49, Martin Storsjö a écrit :

> If I remember correctly, the GL context is thread specific. I'm not  
> sure
> whether you can share the same context in many threads, or if  
> you'll need
> to create a new context for that thread. All of this is platform  
> specific,
> too.

No, I don't think it is a problem, there's no gl magic in a thread.  
Just make sure your threads acquire a lock before calling any  
(section of) gl* commands to mutually exclude them from accessing the  
OpenGL engine.

Note however that depending on the structure of your code this may  
actually decrease performance, each thread always waiting on the  
other. Designating a thread for gl commands is certainly a simpler  
and cleaner solution.

Best,

Daniel



More information about the SDL mailing list