On Mon, Mar 20, 2006 at 05:37:50PM +0100, Leon Freitag wrote: > Why thread-local variables? AFAIK OpenGL is single-threaded in its nature. I > don't know if there are applications that draw opengl in multiple threads in > different contents, and if current code would make any problems with these.
Well, in OpenGL each thread can have its own context (and you can also bind a context to only one thread which explains why multi-threaded D3D applications are such a pain to support). So you can have multi-threaded GL applications with each thread having its own GL context. So instead of retrieving the context on each ENTER_GL / LEAVE_GL macro using the GLX call, one can simply store the currently bound context for the current thread in a thread-local variable. This is what Mike's patch does. Lionel -- Lionel Ulmer - http://www.bbrox.org/