Pbuffer's own render context

I am just wondering… is it really necessary to have a different rendering context for each pbuffer? Isn’t changing render context expensive?

I heard I can share the same render context if the pixelformat is (obviously enough) the same, can somebody confirm that?

Originally posted by Obli:

I heard I can share the same render context if the pixelformat is (obviously enough) the same, can somebody confirm that?

Yes, that is correct. When you’ve created the pbuffer and want to switch to it just use the rendering context of your window/other pbuffer in the wglMakeCurrent call. Be aware though that the call will fail if the pixelformats aren’t compatible.

Uhm, this is another reason to go back and update my window-management api so I can detect when the pixel format is the same.

By the way, I have some hints which are telling me that context switching on pbuffers may be optimized.

Someone here got a benchmark ready to go? I will have to code it my own if not.