PDA

View Full Version : OpenGL animation



11-20-2002, 07:59 PM
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
11-21-2002, 02:03 AM
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.....

nexusone
11-21-2002, 04:57 AM
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!)

11-21-2002, 10:07 PM
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?

nexusone
11-22-2002, 05:26 AM
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?