OpenGL context

I need to be able to release objects (textures, display lists) from a different thread. Of course that doesn’t work because the context is different in the thread outside the main one where the window was initialized. Unfortunately I don’t understand what the context is, so I have some questions.

Is it OS specific? I can find only wglMakeCurrent() command for windows. Since I’m using GLUT I don’t know what HDC I’d pass to it. Is there a GLUT function that would make the context of my window current to some thread?

I take it that if I make the context current, any other thread attempting to call any rendering functions will not work?


A rendering context is an object that represents the OpenGL state. You can understand it as an instance of the GL state machine. In GLUT, context management is done behind the scenes and you can’t access it. Still, your entire idea of making the context current to different threads is bad (for various reasons). Better way would be to send a message to the rendering (OpenGL) thread, telling which objects should be released.