Frame rate limit
Hi, its me again.
I finished my 3d scene, I can see objects and interact with them, but still there is a problem. When I test the program on other PC its too fast. There are any solution for this, any frame rate limiter? And how it works?
Thanks again.
A link a day helps you work rest and play :)
http://www.gaffer.org/game-physics/fix-your-timestep
http://www.gaffer.org/game-physics/fix-your-timestep
You could put a timer in. You could do something like this:
//lastTime, thisTime, elapsed are predefined integers //put this where you call the frame rendering interaction functions thisTime = timeGetTime(); elapsed = thisTime-lastTime; lastTime = thisTime; if(elapsed >= .06/*you could change this to speed up/slow down the program*/) { //Call the frame rendering stuff } //Continue with program
Quote:Original post by dmail
A link a day helps you work rest and play :)
http://www.gaffer.org/game-physics/fix-your-timestep
<snip>
Don't rate me up, I am more than just a number!
I thought I would rate you down to help you in your quest to get to 0. :P
Awesome link.
The Gaffer article on Runge-Kutta 4 integration is also a great one to pick up at the same time.
Wow. On second thought I find an error with my code. Sorry for any problems there. What I have posted will make it so it won't ever update the frame on a fast computer. Change it to this:
Okay, that should do it!
//lastTime, thisTime, elapsed are predefined integers //put this where you call the frame rendering interaction functions thisTime = timeGetTime(); elapsed = thisTime-lastTime; if(elapsed >= .06/*you could change this to speed up/slow down the program*/) { lastTime = thisTime; //Call the frame rendering stuff } //Continue with program
Okay, that should do it!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement