Sign in to follow this  

Frame rate limit

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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



Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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:

    //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!

Share this post


Link to post
Share on other sites

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this