I have an event-based app. I want to swap the buffer any time the window gets covered up by another window. Nothing has changed. If I continually swap the buffers, the screen goes gray. Is there a way to refresh the front buffer without clearing the back buffer, so I can just keep refreshing it without having to redraw?
Instead of this:
No, unless you render to a pbuffer or some other off screen buffer and do the update yourself.
What he said ^^^.
Only swapping to refresh is inherently wrong for a PFD_SWAP_EXCHANGE pixelformat and will fail in many implementations because the update has to be done like any other WM_PAINT handling to be correct.
All window expose messages need to repaint the area previously failing the pixel ownership test (overlapped by a window or moved off the desktop) or the data in all buffers (including front, back, depth, stencil, …) of the pixel is undefined!