PDA

View Full Version : How to delay/pause in OpenGL?



Zackiepoo
05-01-2000, 12:55 PM
I have a program where I have an object rotating. To my surprise, it is rotating very quickly, and I can't think of any way to slow it down. Someone mentioned there may be a delay in the OpenGL library. How do I call this? Thank you!

Humus
05-01-2000, 02:28 PM
You can use the QueryPerformanceCounter() and QueryPerformanceFrequency() function to make a small delay() function.

dmy
05-02-2000, 08:22 AM
another way could be to sync to some timer.

i suppose you're rotating you object this way:

glLoadIdentity();
glRotatef(rot,0,1,0);
<render>
rot+=1;

or something resembling.

build a function like this:

float get_seconds() {
return timeGetTime()/1000.0;
}

and try this:

glLoadIdentity();
glRotatef(get_seconds()*90,0,1,0);
<render>

regardless of your current fps rate, the object will make a complete turn every 4 seconds. ( 90*4=360 degrees )

Dolo/\/\ightY