PDA

View Full Version : Undesired clearing of the front buffer



halo
03-28-2004, 02:29 PM
How can I avoid the problem shown here (http://www.leadwerks.com/post/glhelp.jpg) , caused when another window is dragged over the glviewport, or when the viewport is dragged outside the bounds of the desktop, then back in again?

Thanks.

rgpc
03-28-2004, 05:18 PM
The parts of the buffer that are erased will always be erased (or almost always - essentially the GL specification states that these regions are undefined). If they remain erased when you stop dragging over the region then you are probably drawing to your buffers at an incorrect time (WM_PAINT?).

You need to identify when an area of your window has been erased and redraw it. The easiest way to do this is to draw in a message loop which is in the Nehe base code. It's something like this...


while(!done)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message==WM_QUIT)
{
done=TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
else
{
if (active)
{
if (keys[VK_ESCAPE])
{
done=TRUE;
}
else
{
DrawGLScene();
SwapBuffers(hDC);
}
}
}
}

halo
03-28-2004, 05:23 PM
So you are saying that any time I drag a window over one of my viewports, I need to detect it and re-render the whole scene?

halo
03-28-2004, 06:22 PM
Okay, will continue there.