PDA

View Full Version : contexts, wglsharelists & textures...



Mark Shaxted
08-04-2007, 03:05 AM
I have an application which uses two top level windows for rendering in a multi monitor configuration. I need to be able to switch to and from fullscreen mode (ChangeDisplaySettingsEx) on both monitors. My understanding (from Nehe) is that I need to set fullscreen mode before creating the windows, which means I must destroy and recreate each window for each mode change, which also means I must destroy and recreate opengl contexts for each window. This implies that I must reload all textures upon mode change.

Firstly, would a reasonable strategy be to create a third hidden window (maybe 1x1 pixel) and use this to share textures with the two visible windows? This would remove the need to reload textures at each mode change.

Secondly, using wglShareLists, does it matter which context is current when creating the shared textures? For example...

dummyContext (hidden, shares it's resources)
window1Context (get recreated on mode change)
window2Context (get recreated on mode change)

wglShareLists( dummyContext, window1Context);
wglShareLists( dummyContext, window2Context);

...if I make current the dummy context and create a new texture it will be shared with both window contexts - that's fine. However, if, for example, window1Context is the current context when I create a new texture will it be visible to window2Context? Or should I always switch back to the dummy context when creating textures?

Many thanks.
Mark

mfort
08-04-2007, 06:34 AM
textures are "visible" in all shared contexts.
It doesn't matter in which context the texture was
created. So yes, if you create texture in win1ctx it will be available in win2ctx.