PDA

View Full Version : Animation problems



Floods
10-21-2014, 12:15 AM
Hi guys,

New to OpenGL and wondering if anyone can help me out. I have a mesh that has animations created using the 'Your First Animation' tutorial using blender (link forbidden for some reason), and I have a function to handle the bone transformations. However I'm not sure how to get the timings to pass to that function, how to get which frame the animation should be on. Presently, I have a variable which I increment inside my display function and then pass in, which works but seems like a very poor way of doing things. I'm using glut and have an array of (pointers to) aiScene objects to handle my meshes.

In short, I need an expression giving the time relative to the start of the animation measured in frames. Can anyone help?

carsten neumann
10-21-2014, 01:49 AM
Often animation data is encoded over time (not frames) because that allows playback at a fixed speed independent of how fast your hardware can render images. You can use glutGet(GLUT_ELAPSED_TIME) to get the elapsed time (since glutInit IIRC) and to get the time since you started an animation you store when you started the animation and subtract that.
If you really want to count frames increasing a counter seems the way to go. One can hide that behind whatever fancy interfaces to avoid a global variable, but in the end it boils down to a variable that is incremented each time you render an image.

Floods
10-21-2014, 08:50 AM
Thanks very much, got it sorted