skaslev / gl3w

Simple OpenGL core profile loading
http://github.com/skaslev/gl3w
The Unlicense
705 stars 157 forks source link

Make gl3wProcs thread-local in C11 version #62

Open ikskuh opened 5 years ago

ikskuh commented 5 years ago

Hey!

I'm building a multi-threaded OpenGL application and require gl3wProcs to be thread local storage (so i can use multiple contexts with each their own function pointers).

I don't have a patch, but the only thing that must be changed is two lines of code:

// gl3w.h:
extern _Thread_local union GL3WProcs gl3wProcs; // added _Thread_local here

// gl3w.c:
_Thread_local union GL3WProcs gl3wProcs; // added _Thread_local here

This feature could also be optional with a preprocessor option GL3W_THREAD_LOCAL or similar...

Regards Felix