how to control the mainloop interval?

I used to set a timer in MFC and make my render step with the TIMER Message,so I can control the interval of my app to swapbuffers,and it do well.

but I am now lost in glut.*&%^$^$%$#^%%$#$@#$
I only know the func glutMainLoop(void),but how can i control the loop interval by myself?

thank for your help or your notice me.

In glut you can’t. You must use winbloze code for that. (since glut is shell to winbloze)

You can use the glutIdleFunc to control the framerate. The following pseudocode will lock the applicaiton at 50 FPS using GLUT.

int main()
{

glutIdleFunc(Idle);

glutMainLoop();
}
void Idle(void)
{
while((GetCurrentTime - lastTime) < 20 milliseconds) {do nothing}
lastTime = GetCurrentTime();
glutPostRedisplay();
}

There’s also a glutTimerFunc. I haven’t used it much, but my guess is that it’s accuracy is comparable to the Win32/MFC timer events.