A question for you about sharing OpenGL contexts. I'll explain what's going on, and maybe you will see a problem with my setup or execution : ) The overall idea is to have a thread generate textures while another thread displays those textures.
I create a context, called "DisplayContext".
I then create a shared context, called "CreateContext", that shares memory of the first context.
I create a bunch of textures inside the DisplayContext giving them names with glGenTextures. These names should be known in both contexts. For each image I want to display there are double the textures needed such that I can display and create a different set at a time (my double-buffered scheme).
I kick off a thread that runs my CreateContext. It is made current at the start of the thread and whenever a shared memory region is updated, it binds a texture (or textures) and fills in the memory. My setup is double-buffered such that the DisplayContext and CreateContext should never look at the same texture at the same time. When the background buffer is filled the flag is changed and then the DisplayContext should start using the newly created set of textures.
As the program gets going where both threads are working simultaneously, there are often glBindTexture errors in either thread that kills processing.
If the texture IDs are unique, why would there be an error? Are contexts current in either thread, or is there one "global current context" and each thread keeps setting the current while the other is doing something else (say, inbetween a glBegin and glEnd call)?
Any ideas? I can provide more information, just ask!