maximum frame rate?

how can i define the frame rate that i want my program to run at?

Cheers

JT

have a timer, and only update the display after a certain number of milliseconds.

currently i have my display function as my idle function so that the screen is continually updating all the time as the program changes things in the background…am i right in thinking that i would change my idle funtion to a timer function which periodically calls the display function?

Is this the only way to do it? ie is there no way i can just specify a maximum frame rate i want opengl to run at? I dont really care what frame rate its running at, but i just need to know what speed it is ( i know it could vary slightly) if there was a simple program i could run that would tell me this that would be enough. I am interpolating between key frames, and these key frames occur at specific time intervals. I therefore need some way of finding/setting the frame rate so that i can calculate how many frames I need to make in between these key frames for the program to stay in sync. (I am modelling speech returned from a speech engine from which i can determine which pose (viseme) i need to model and how long that pose lasts and also which pose comes next, so i need to know a frame rate so that i can calculate the right number of frames to smoothly fill the transition between poses) I hope that made sense!

it made perfect sense. However a better way to do any sort of time based interpolation is as follows.
Render the screen as often as you possibly can.
Update your data every frame.
However, when you update the data use a timer, like timeGetTime() to measure the elapsed time since the last up date. In a simpistic case if you want an object to move 1unit/s and .1 s have passed since the last update, move it .1 units. The advantage to this method is that users of faster compters see smoother animation. I hope this makes sense and is useful to you.

Thanks-only one thing though…doesnt timeGetTime simply return the system time in milliseconds, which is just the time since windows was started? How could I use this to work out when the display was last refreshed?

Sorry, stupid question…Get time in display function, and get time in other function and work out the difference!!

chowe, I like that resolution alot. A bunch of people just like to limit the fps, but that solution is alot more effective and cleaner.

that solution is good if you don’t care how much time is devoted to your drawing operations. there may be a situation where you only want to dedicate a certain amount of time to drawing.

to limit your fps, work out the time each frame covers, if you want to have 30fps, 1 frame lasts about 33ms. then at the start of each frame record the time, after the frame is draw get the time and work out the difference in times (dt) which will give you how long it too to draw everything. work out your excess time i.e. et=33-dt, then just sleep for et amount of milliseconds.

this solution may not be appropriate to you however.