Sign in to follow this  

How to create an Animation in OpenGL ?

Recommended Posts

Create a timer that tracks elapsed time. At regular intervals, update your elapsed time and then update the position of your object so that it traverses the line. If you define your line as a parametric equation:
p = p0 + t·u
p will be the position of the object at elapsed time t.
To play and pause, have a flag that you set on a key press. If the flag is true, update the elapsed time, otherwise, don't update elapsed time (t will not change, so p will not change, and so the object will not move).

Share this post

Link to post
Share on other sites

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