I’m making a simple program in OpenGL that displays a quad. I have idle function that increments a global “time” variable so that I can alter my model as time progresses to create a sort of animation effect.
void idle()
{
time += 0.01f;
glutPostRedisplay();
}
But the problem is that as soon as this glutPostRedisplay is called my model disappears instantly and screen turns out to be black. Any clues why ?
The same problem appears if I just resize my window i.e. maximize it. Why this redrawing problem any idea ?
I fixed my problem somehow. I wasn’t restoring the modelview matrix after my display function. and that resulted in this behaviour…Now I do a Push at entry and exit at pop.