View Full Version : state managment for pbuffer/render_texture

01-19-2003, 12:35 PM

is it possible to share the rendering context between main window/pbuffer and use render_texture ? If i try this, the texture is only pixel garbage. With two different contexts it works.

Can you use wglCopyContext for pbuffer/render_texture to copy state ? My program crashes at wglCopyContext :-(

How do you manage your render state with pbuffer/render_texture ?

01-20-2003, 02:34 AM
You can share contexts between a pbuffer and the main window within certain constraints (the only one I remember is that the pixelformats have to be the same).

If I remember correctly, render-to-texture requires a special pixelformat which is unlikely to be available on the main window, so I guess you can't share the contexts when using render-to-texture.

01-21-2003, 04:42 AM
ah yes, that makes sense. And the wglCopyContext ? Is that possible ? I mean you can't do that much wrong using that, but it crashes. Are they also incompatible ?

01-21-2003, 04:51 AM
Never used wglCopyContext, but from MSDN:

"When you call wglCopyContext, make sure that the destination rendering context, hglrcDst, is not current to any thread."

A possibility for crashing perhaps.

01-21-2003, 05:19 AM
i know, the destination context is not current but it crashes.

How do you manage the different render contexts ? By hand is really error prone, or you have to implement your own state manager http://www.opengl.org/discussion_boards/ubb/frown.gif

01-23-2003, 08:31 AM
You would have choosen the pbuffer pixelformat with wglChoosePixelFormatARB, but what did you choose the pixel format for the main window with? the standard ChoosePixelFormat? If so, perhaps copy context fails because of that. Just another guess.