# OpenGL animation

Anybody know where I could see a simple OpenGL(C++) sample code to show how aniamtion is done?
My math is bad, I got very confused by all those curve formulas and don’t how I can apply them.
Help! It’s the end of the semester, and everything is almost due(not to metion finals!)

animation in what sense? obviously putting a glrotate in your draw func will gove you animation… you mean along a path or a person walking or…

Take a look at my clock example, in perspective mode is it is animated and moving.
http://www.angelfire.com/linux/nexusone/

Originally posted by heeeee:
Anybody know where I could see a simple OpenGL(C++) sample code to show how aniamtion is done?
My math is bad, I got very confused by all those curve formulas and don’t how I can apply them.
Help! It’s the end of the semester, and everything is almost due(not to metion finals!)

Gavin, nexusone, thank you for your reply.my problem is to move an object along a precomputed trajectories and must have speed control. nexusone, I looked at your code, it’s very cool. I noticed that you are moving the camera(lookat) to create the animation effect. So the whole scene will move. If a person is walking along a road, should I achieve the animation effect by moving the person using translate, reotate? How can I apply speed control?

You can use ether gluLookAt or translate/rotate to move through your world.
Remember OpenGL does move the camera, but the world around it to get the same effect.

I use a timer function for speed control, also you could use a variable to set rate of movement of you person on the road.

I would have two variables, rate and speed, being rate is how often to update object, and speed is amount of movement on each update.

Originally posted by heeeeeee:
Gavin, nexusone, thank you for your reply.my problem is to move an object along a precomputed trajectories and must have speed control. nexusone, I looked at your code, it’s very cool. I noticed that you are moving the camera(lookat) to create the animation effect. So the whole scene will move. If a person is walking along a road, should I achieve the animation effect by moving the person using translate, reotate? How can I apply speed control?