In both NeHe’s tutorials and many commercial game products, switching to a different resolution full-screen OpenGL mode will redraw a frame of the desktop under the new resolution (ie a cropped upper-left-corner image of the desktop). I was just wondering if there was a cleaner way of doing this… such as clearing (or fading out) the previous screen before the resolution change, and whether this could be accomplished in OpenGL.
The reason why this happens is because when switching screen modes windows requires you to destroy the window you are working with and recreate a new one in the new mode (that might not be the most exact explanation, but its close enough for our purposes).
Between the moment you destroy your old window and the moment you create your new one, windows jumps up flailing its arms saying, “wait! wait! I wanna draw too!” and then it draws the desktop.
You can work around this in a couple of ways.
You could create a seperate window as your top level window which is just a normal window that covers the whole screen, when changing resolutions make sure to set this window to have the correct size. Your OpenGL window should be in front of this window. When you destroy your GL window, it should display your background window instead of the desktop.
Alternately, you could create a background window just before you destroy your GL window and destroy it after you’ve created your new GL window.
You could (if you wanted) adjust all you gamma values down to nothing before destroying your GL window and set them back after creating your new GL window (I dont recommend this though, it doesnt work on all cards (actually 3dfx pass-through cards are the only ones I know that dont work) and if your program happened to crash before you set the gamma ramp back you might be stuck with a black screen until you reboot).
Any of those solutions should work, but I havent tested them so I make no garuntee.