multiple rendering contexts, multi-texture states?

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?

thanks,

trey

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.

thanks, that’s the most concise specific answer I could have hoped for =)