View Full Version : multiple rendering contexts, multi-texture states?

01-25-2005, 02:29 PM
I've been trying to find what the opengl spec says about the state of texture units after rendering context switches, but I'm not having much luck.

Here's the confusion:

suppose I create a window with a gl context and start rendering to it. i create texture #1 and bind it to texture unit 0. I draw a textured square.

then, I create a pbuffer. I call wglShareLists so that the pbuffer and window context share texture names. I create texture #2 and bind it to texture unit 0. I draw a textured square.

When I switch contexts from the pbuffer back to the window context, what is the state of texture unit 0 and what is bound to it? Is there anything bound? Is it texture #1? Is it texture #2? Is it undefined?

There's reasons to think that it might be either of the 3 conditions.. texture #1 (if texture unit states are maintained by the driver when rendering contexts are switched).. texture #2 (if all rendering contexts share the same texture unit state).. or undefined (if switching away from a rendering context makes no guarantees about what the texture unit states are when you return).

any ideas/experience/references to documentation anywhere?



01-25-2005, 05:21 PM
Each context has fully separate state.
Objects can be shared, state is never shared.

Bindings are state.

After switching to the pbuffer context and back, the first context (still) has texture #1 bound on "unit" 0.

01-26-2005, 09:37 AM
thanks, that's the most concise specific answer I could have hoped for =)