View Full Version : Redrawing fails when glutPostRedisplay() called

04-16-2004, 06:21 PM

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;

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 ?

~ Thanks in advance

Andrew Davey
04-16-2004, 09:52 PM
sounds like you might not have a resize function.

Have you not got one?

from my, limited, knowledge openGL upon resize looks for a resize function, if one isnt there it will not draw, but i could be wrong.

Other than that i dont know. But i do this for my redisplay try it:

void timeEvent(int te){
//your bit in here



}//timeEvent(int)It gets called in display the first time:

glutTimerFunc(20,timeEvent,1);This basically refreshes the screen every 20 milliseconds. It recursivly calls it self which also has the redisplay.

(This what i uynderstand is happening)

Does any of what i say make sense or help?

04-17-2004, 05:50 PM
Hey thanks.

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.