PDA

View Full Version : PBuffer and Fullscreen switching



EdGe
04-30-2003, 12:40 AM
Hi all,

i used Nehe "Class Basecode" to begin an application, then included my Pbuffer class, and what a surprise, all content of pbuffer is lost after switching to fullscreen, or rolling back... in fact app runs, but screen becoms white, and i'm sure i didnt loose OpenGl Context... have u the same problem ?

I tried to shutdown my pbuffer and recreate it after the switch, but it's the same !

I dont understand what happen when switching to fullscreen...

thanx !

Relic
04-30-2003, 06:47 AM
You switched resolutions while you have OpenGL running? That is generally not safe to do, although it might work in some implementations.
Switch your resolution before you choose/enumerate the pixelformat and back after you've destoyed the window. This guarantees that you never have selected pixelformats which may not be the ones available in the "other" resolution.

Mihail121
04-30-2003, 10:09 AM
To do resolution switching without destroying to context,window and etc. is extremely dangerous and might have undefined results....

Humus
04-30-2003, 10:43 AM
OpenGL garantuees the survival of certain objects across resolution switches, such as textures and display lists. PBuffers however is not garantueed to survive, that's why there's a query to check whether the PBuffer was lost. If it's lost, you need to recreate it.

jwatte
04-30-2003, 03:26 PM
We switch resolution while having active GL context/contexts. We also use pbuffers. Aside from miscellaneous driver bugs (from many vendors), it works fine. We do lose the buffers, and use the query to know when to re-establish the buffer.

If you want to save the data out of the buffer across a context switch, use ReadPixels or CopyTexSubImage, as appropriate.

rgpc
04-30-2003, 07:03 PM
From the extension registry (ie. As Jon said...)



4. The pixel buffer might be lost if a display mode change occurs. A query is provided that can be called after a display mode change to determine the state of the pixel buffer.


and...



The frame buffer resources that are associated with a pbuffer are also static and are deallocated when the pbuffer is destroyed or possibly when a display mode change occurs.



Basically shutting down your pbuffer after the switch would cause you problems (because it doesn't exist) - you need to query it's existence and recreate it if it's been lost.

[This message has been edited by rgpc (edited 04-30-2003).]

EdGe
05-05-2003, 04:59 AM
Ok, thanks a lot guys,

i'm doing right things in correct order now i think http://www.opengl.org/discussion_boards/ubb/smile.gif

But there is still another problem: I use simultaneously 2 Pbuffers. All is ok in 2048*2048, but when i use 1024*1024 (or 2048*1024 and not in 1024*2048), all is ok in windowed mode, but "random" parts of screen are not refreshed in fullscreen mode ! I think it depends on Zbuffer because refresh of those stranges parts depends on depth of current pixel, and all works well when Zbuffer is switched off...

i use 32 bpp, 16b zbuffer... and when i come back to windowed mode (same init, just a flag is changed) all works well again...

strange no ?