OpenGL and threading
It's known that OpenGL drivers usually don't tolerate [multi]threading. However, does one have to deal with the main thread (of e.g. SDL) that brought up a GL context? If one spawns a thread and from then on only from there dispatches OpenGL commands will it be safe? Or does it have to be restricted to the main thread that brought up 开发者_开发知识库the GL context?
You need to make the OpenGL context current on the thread you want to use it, and a context can be made current only on one thread at a time. So creating a context and using it from another thread is fine if you make it current.
For multiple threads using OpenGL, you need multiple OpenGL contexts, one for each thread. And you can share resources between OpenGL contexts.
精彩评论