View Full Version : wglCopyContext between pbufffers?

05-05-2004, 02:04 PM
I have two pbuffers with the same pixel format. I create the first pbuffer first and setup rendering states. Right after the sencond pbuffer is created (before it is made current), I calls
wglCopyContext(pbuffer_1.hrc, pbuffer_2.hrc, GL_ALL_ATTRIB_BITS). In NVidia card, it crashes. In ATI Radeon 9600XT, it didn't crash, but the texture in second pbuffer is gone no matter how I enable and load the texture when second pbuffer is made current. If I comment out wglCopyContext, everything works fine except that I have to setup rendering state again.

Any one has any experience on wglCopyContext?

05-05-2004, 03:39 PM
From the MSDN library:

Using the wglCopyContext function, you can synchronize the rendering state of two rendering contexts. You can only copy the rendering state between two rendering contexts within the same process. The rendering contexts must be from the same OpenGL implementation. For example, you can always copy a rendering state between two rendering contexts with identical pixel format in the same process.

You can copy the same state information available only with the glPushAttrib function. You cannot copy some state information, such as pixel pack/unpack state, render mode state, select state, and feedback state. When you call wglCopyContext, make sure that the destination rendering context, hglrcDst, is not current to any thread.
Hope this helps.