Hi,
I think that the discussion here got a bit side tracked.
I haven't seen in this thread any actual referenced how frame rate capping can be done accurately in the case where vertical sync isn't enabled.
Actually one could argue that if "wait vertical refresh" is enabled, you shouldn't try to cap your frame rate. Consider case where your monitor frequency is 60hz and you try to cap to 45fps. Every 4th frame on screen would be the same as the frame before which in my opinion could look like stuttering. Or your cap is at 30fps and your monitor works at 75hz.
However, for the original question:
[color="#1C2837"][color="#000000"]mUpdateTimer[color="#666600"].[color="#660066"]TimeElapsed[color="#666600"]()
Does the above function return floats or integer numbers. In case of integers, the integer rounding will make your program run slightly faster than you think. It may or may not be a problem. However, if vertical sync is enabled, your calculations may interfere and possibly cause stuttering.
Usually the update frequency is less than the drawing frequency (ie. drawing at 60fps and updating at 30fps).
In this case, for the frames between updates you'll need to interpolate positions and rotations etc.
In my current project I haven't implemented explicit frame rate capping, but logic updates are running at 30fps, which saves a huge deal of calculations and actually increases the drawn frames. Even if I don't cap anything, my processor is running at ~10% load (4 cores with HT) since my GPU is the bottleneck.
Cheers!
Thank you. It actually does return integers, but it wouldn't be a problem to make it return floats. The reason I was minimizing the rendering is because I've read that rendering takes much more time and processing power than updating does. I'm just trying to get on the right track to making a game that runs equally well on all pc's so that I can stop worrying about the boring engine stuff and start doing the fun logic stuff.
P.S. can you post an article link on interpolation or a tutorial or something to help me with it?