PDA

View Full Version : how to clear screen after drawing?



coda
12-11-2003, 11:27 PM
i tried clearing screen to black using

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); and

glClearColor(0.0f, 0.0f, 0.0f, 1.0f );

but my scene still remains

12-12-2003, 12:01 AM
Maybe you should try in that order :




glClearColor(0.0f, 0.0f, 0.0f, 1.0f );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


Steve.

Leyder Dylan
12-12-2003, 01:17 AM
Hi,

I tryed that and that works :




glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clean the screen and the depth buffer
glLoadIdentity(); // Reset The Projection Matrix

coda
12-12-2003, 03:09 AM
I want to clear that screen on clicking a dialog button so i tried all the above in my button function but still nt working.

cwc36
12-13-2003, 10:40 PM
Hi,

have you put the glutSwapBuffer() at the bottom of the display function()?

cwc36
12-13-2003, 10:43 PM
Hi,

Try to do it as below:

OnTimer()
{
SendMessage(WM_PAINT);
}

Hopi it can help.

coda
12-13-2003, 11:29 PM
thank you! i did nt swapbuffers in my function