View Full Version : FullScreen flicker problem
01-19-2007, 08:31 PM
I'm working with a very simple 2D/ortho application where I want to clear the background just once at the beginning (so that all shapes leave a trail.) I'm programming in C++ on Windows. It works 100% fine when windowed, but as soon as I run it fullscreen, there is a terrible flicker (and you can see the computer's desktop behind my app.) I've tried with and w/o glut.
In other words, the app starts up with "once = true" then:
once = false;
Any suggestions? I'm really stuck!!
01-20-2007, 12:29 AM
The reason is that you set the monitor refresh rate to 60 HZ.
With windows programming, you can use this code to get the current monitor refresh rate:
DEVMODE dmScreenSettings; // device mode
EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &dmScreenSettings);
dmScreenSettings.dmPelsWidth = width; // screen width
dmScreenSettings.dmPelsHeight = height; // screen height
dmScreenSettings.dmBitsPerPel = bitsPerPixel; // bits per pixel
if (ChangeDisplaySettings (&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
return FALSE; // Display Change Failed, Return False
}I have no idea how to change the glut settings.
You should also clear the color buffer in each frame. So remove the "once" variable from your code.
If you use double buffering try to clear both buffers.
For the flickering I don't know the reason.
01-20-2007, 04:13 AM
I apologize b/c I am somewhat of a beginner. A few things:
1 -- Are you saying I should change the refresh rate to 60HZ or not? I have that code (from the NEHE examples) already in my app, not sure what it does other than say fullscreen not suppored.
2 -- The "once" is key to my program since I do not want to clear the color buffer each frame. I have a line that moves around the screen and I need to see its trail.
3 -- I believe I am using double-buffering, how do I clear both buffers as opposed to one?
Thanks to everyone for their help!!!
01-20-2007, 07:28 AM
Ah, ok, I guess I know what is going on...
If you use double-buffering, then you swap buffers each frame via glutSwapBuffers. It swaps teh back buffer (one you render to) and the front buffer (one you see). The problem is that the back buffer is usually undefined after swapping, so you most probably get a lot of "waste" in it (like the desktop window).
As to a solution of your problem, I don't really know, because I never did anything similar. I suggest that you render the trail anew each frame if possible, or use the accumulation buffer.
Hope it helps.
01-21-2007, 12:41 AM
1)Use EnumeDisplaySettings()to get the current settings( So current refresh rate of monitor ).If the current refresh rate is 60 HZ, EnumeDisplaySettings() sets the refresh rate to 60 HZ. If it's 85HZ, this function sets the refresh rate to 85HZ.
2) Remove once variable and see the results. Does it solve the flicker problem?If not, don't remove this variable, since this is part of your program.
3)Does glDrawBuffer( GL_BACK ) solve your problem?
01-21-2007, 02:04 PM
I want to clear the background just once at the beginning (so that all shapes leave a trail.) Then, as a GL beginner, your best bet is use single buffering (or always draw to GL_FRONT and do not use swapbuffers !).
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.