PDA

View Full Version : OGL-app in fullscreen; other windows on top of it appear strange (win98se)



B_old
08-23-2003, 06:44 AM
Hello.
When my app is in fullscreen mode and I attempt to display any window on top of it they appear strange. They are blinking fast, and the ogl-scene shines through in a way.
My dwStyle is WS_POPUP, WS_POPUPWINDOW for example doesn't have those problems but is significantly slower, though.

I would like to display a second window that works as a console.

Thanks for any help!

AdrianD
08-23-2003, 10:34 AM
your problem is page flipping.
in window mode when calling swapbuffers, opengl copies the backbuffer with a blit into the fromtbuffer using a clipping-mask (for overlapping windows).
howerver, when you switch to fullscreen the driver uses buffer flipping. in this method, only the pointer to the currently visible buffer is changed. the buffers are switched.

fortunately, there are some a ways from preventing opengl using buffer flipping:

1st method:
with no coding but for nvidia only.
nvidia drivers allow you to choose the buffer flipping mode: set it to "copy buffer"

2nd method:
check all available pixelformats (with DescribePixelFormat) and check for the presence of the PFD_SWAP_COPY or PFD_SWAP_FLIP flags.

3rd method:
this is the easiest way: switch to fullscreen mode but don't open an fullscren openGL window. make it just 1 pixel smaller (ie: for 800x600 fullscreen use a 799x600 or 800x599 window)
this makes opengl to run in windowed mode and the buffer-copy method is used for swapbuffers.
ofcourse you have to deal with the problem that you have one line or row, wich could show some desktop parts. but this is not a real problem, and i'm sure you know how to handle it... http://www.opengl.org/discussion_boards/ubb/wink.gif

B_old
08-24-2003, 01:24 AM
Hi!
Thanks for the reply. I am wondering wether this will slow down the app in any way? I could imagine the cards are optimized for this buffer flipping.
And I don't really like the idea to have fullscreen with queer resolutions. http://www.opengl.org/discussion_boards/ubb/smile.gif

How to people present their console? (Apart from the quake method)

AdrianD
08-24-2003, 04:48 AM
that's right. page flipping is the fastest and optimized way. it was inventend back at the time, where it was a real challage to blit the whole screen at once....
but today the blitting of a buffer is made really fast on most GPU's so you won't notice any real performace difference.

B_old
08-24-2003, 05:37 AM
Hi!
I tried method 1 & 3. Unfortunately it is slower. I assume 2 will give the same results, but could you explain a bit more detailed how I can enable this, anyway?
Thanks for the help!

AdrianD
08-25-2003, 02:09 AM
try this piece of code out. i think this should explain, how this func works.




int SetDCPixelFormat(gxCONTEXT *gxC,HDC hDC,unsigned int bpp)
{ int nPixelFormat=0;
int t,pfnum,r,pt,maxpt;
char flags[2048];

PIXELFORMATDESCRIPTOR dpfd;

pfnum = DescribePixelFormat(hDC, 0, 0,0L);
if(!pfnum)return 0L; // ERROR->NOTHING FOUND

//gxdbs(800,(s,"request:ChoosePixelFormat:%d possible modes found",pfnum));
nPixelFormat = -1;
maxpt = 0;
for(t=1;t<pfnum;t++)
{ // jetzt alle testen, und den besten match suchen....
memset(&amp;dpfd,0,sizeof(dpfd));
r = DescribePixelFormat(hDC, t, sizeof(dpfd),&amp;dpfd);
if(r==0)
{ //gxdb(800,"error");
break; // das wars...
}
strcpy(flags,"flags:");
if(dpfd.dwFlags & PFD_DRAW_TO_WINDOW) strcat(flags," DRAW_TO_WINDOW");
if(dpfd.dwFlags & PFD_DRAW_TO_BITMAP) strcat(flags," DRAW_TO_BITMAP");
if(dpfd.dwFlags & PFD_SWAP_COPY) strcat(flags," SWAP_COPY");
if(dpfd.dwFlags & PFD_SWAP_EXCHANGE) strcat(flags," SWAP_FLIP");
if(dpfd.dwFlags & PFD_SUPPORT_OPENGL) strcat(flags," OPENGL");
if(dpfd.dwFlags & PFD_SUPPORT_GDI) strcat(flags," GDI");
if(dpfd.dwFlags & PFD_DOUBLEBUFFER) strcat(flags," DOUBLEBUFFER");
if(dpfd.dwFlags & PFD_STEREO) strcat(flags," STEREO");
if(dpfd.dwFlags & PFD_GENERIC_FORMAT) strcat(flags," GENERIC");
if(dpfd.dwFlags & PFD_NEED_PALETTE) strcat(flags," NEED_PALETTE");
if(dpfd.dwFlags & PFD_NEED_SYSTEM_PALETTE) strcat(flags," NEED_SYSTEM_PALETTE");
if(dpfd.dwFlags & PFD_GENERIC_ACCELERATED) strcat(flags," ACCELERATED");

// just output
fprintf(stdout, "color:%d depth:%d alpha:% stencil:%d %s",
dpfd.cColorBits,dpfd.cDepthBits,dpfd.cAlphaBits,
dpfd.cStencilBits, flags);

// make your check for some of the flags HERE

}

}


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglr_9ygk.asp

[This message has been edited by AdrianD (edited 08-25-2003).]

B_old
08-25-2003, 02:38 AM
Thanks!