OpenGl cross thread calls under WIN32 OS

I have following problem: My application is running in 2 threads. It is nessesery to execute OpenGl commands from a different thread than the one in witch OpenGl was initializated. It looks like it does not work under Win32 API - opengl commands are accepted only from the thread witch had intilaized the OpenGl. I can not use only one thread (the aplication architecture is fixed by some external standard). Some idea what to do (e.g. how to jump from on thread to another, execute OpenGl , jump bakc) ?

I’ve encountered the same problem. I found, that certain commands like glDeleteTextures() cannot occure between glBegin() glEnd(), so you have to lock the critical sections.

I just want to know, if it is possible to invoke glDeleteTextures() from another thread?

For any hints I thank in advance,
Mete Ciragan

You definitely need to call wglMakeCurrent for each thread, you may need a new DC or RC for each thread. I’m not sure exactly which handles can be passed between threads.

Are you calling GL commands from both threads? That is a very risky thing, and generally a no-no thing to do. As I understand it both threads share the same OpenGL state, so any state change in one thread affects how the other thread behaves (and most OpenGL API calls are state changes).

marcus: It is exactly what I must to do. Call OpenGl commands from both threads.
I can putt all OpenGl commands in each thread in one critical section - Ii hope it can help.