Has opengl got timer functions?

Hi, I’m messing around with opengl’s 2d orthog mode and I’ve been trying to draw a gravity simulation, everything is working but it’s going far too fast, and I’m getting flicker (which i presume is to do with the differences in monitor refresh rate and draw speed), and I was wondering if opengl or any of the vc++ librarys have a function that can return the time in milliseconds from the start of the program, or something like that? I could use this to maintain a constant delay between drawing… or is there an easier way? I’m not using mfc btw…

Thanks heaps, sincerely - Andrew

Check out glutTimerFunc

GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);

Flickering may be due to your app running in single buffered mode. If your using GLUT, try glutInitDisplayMode( … | GLUT_DOUBLE); and put a glutSwapBuffers(); at the end of your drawing function. If you’re not using GLUT, each windowing API will have method of turning double buffering on.

Hope that helps.