PDA

View Full Version : wglMakeCurrent - am I losing GL state or objects?



therealremi
07-28-2009, 11:43 AM
My scenario is this: I call wglMakeCurrent, set GL state, create GL objects and render in thread A. When I'm done I release the context in that thread by calling wglMakeCurrent(NULL, NULL). After some time I want to render using the same GL rendering context in thread B so I call wglMakeCurrent in that thread.
The question is: what becomes invalid after making the context current in another thread?
It's not at all intuitive for me to expect any particular behaviour from OpenGL in this case.
I'm frustrated cause this seems like a "grey zone" - I cannot find any info about this in either Microsoft docs nor OpenGL specs.
Can anyone point me to some documentation about such issues?

therealremi
07-28-2009, 01:09 PM
Ok, I tested it on ATI and it seems like everything is preserved. But is that a rule? Can I in general rely on GL state and objects being preserved after calling wglMakeCurrent?

Brolingstanz
07-29-2009, 01:13 PM
I think all this is spelled out in the spec(s). Appendix D of both the 3.0 and 3.1 specs for example go into a bit of detail on shared state (3.1 details a set of rules).