how to clear screen after drawing?

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

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.

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

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.

Hi,

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

Hi,

Try to do it as below:

OnTimer()
{
SendMessage(WM_PAINT);
}

Hopi it can help.

thank you! i did nt swapbuffers in my function