Sign in to follow this  

objects rotating really fast

This topic is 4528 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

something weird is happening :) when i run the lessons with rotating objects on my main computer they spin really fast while when i run it on my other computer wich got less fast hardware it rotates smoothly and 'slowly' anyone knows howcome ? :)

Share this post


Link to post
Share on other sites
The variable that controls the rotation is updated every time a frame is rendered. If you move 0.1f per frame then at 100 FPS you move 100 * 0.1f = 10 rotations a second, if you can only manage 20 FPS then you'll move at 20 * 0.1f = 2 rotations a second. If you move too fast then you'll get jerky movement, simple as that :)

If you're just learning then it's nothing to worry about at the moment but if you want to 'fix' this then you need to time how long a frame takes to render and scale the movement by that. A different solution would be to separate the updating of the variable from its rendering and use a fixed update frequency.

Some timer code in Lesson 21

Hope that helps :)

Share this post


Link to post
Share on other sites
No problems. Welcome to NeHe and the wonderful world of OpenGL :D

I'll point you over to the forums FAQ, it's got some excellent tips and shows you the correct way to post code segments, which as you're learning will be helpful I'd imagine ;)

Share this post


Link to post
Share on other sites

This topic is 4528 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