Hello everyone! I'm new to OpenGL and new to this forum.
I am trying to make a program, in which I draw on screen using the mouse. When I press Esc in keyboard, I would like to delete everything I've drawn. For that purpose I use this keyboard function:
void ExitDraw(unsigned char key, int x, int y)
{
if(key==27) glClear(GL_COLOR_BUFFER_BIT); //clear the window by pressing Esc
glutPostRedisplay();
}
This deletes every point I've drawn except for the last one! What is wrong? I don't get it...
Thanks for everyone's help in advance!![]()





