🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Animation

Started by
1 comment, last by DarkAstaroth 24 years ago
Mmmm.. I tried posting this here yesterday and it never came up (Prob just screwed something up Anyway - I''ve been working on my little OpenGL demo for a few weeks now.. I''ve managed to conqueor most simple things (ie Loading up vertices/polys, setup lighting, applied textures etc...) but now I want to implement animation. My problem is I''m using a lot of display lists to keep my code nice and fast and now that I want to animate my objects they seem to be tied up in the display lists. I can seem to find demos/tutorials on all the other aspects of OpenGL/3d except on how to setup/handle animation - Anyone got any ideas/tricks (Anyone inclined to write a tutorial??) -DarkAstaroth
"You think that''s air your breathing now?"
Advertisement
Hi DarkAstaroth,

If you want to keep your existing style (ie, using display lists), what you could do is load up a shite-load (technical term ) of meshes that represent the object at different key frames of their movement, and capture the drawing of each in a display list. Then, when you want to show the animation, just cycle through the display lists (its the same idea as a cartoon - each image slightly different to the one before, giving the illusion of movement).

The downside of this method is that it may be a little memory-hungry (I don''t actually know).

Option B could be that, in your drawing function, you specify vertices of an object by giving an index into an array of vertices. When you want to, for instance, move the object''s "arm", just alter the vertices in the vertex array that are part of the "arm" - the object is still topologically the same (relationships between vertices haven''t changed), so the draw function remains the same (indices into the vertex array remain unchanged, only the actual vertex information is altered).

The downside of this second method is that you can''t use display lists, because they can only contain static geometry (even though using indices into an array should work in theory, a display list is simply a snapshot of whatever values were at the given indices at build time). If you use this method, look into using glDrawElements and related functions.

Hope I didn''t gibber on too randomly




-------------
squirrels are a remarkable source of protein...
Cheers -- i''m currently playing with Vertex Arrays and DrawArrays (Although they are quite a bit slower)

I was thinking about using Display Lists just for objects that need to be translated/rotated/scaled and have each object drawn into an accumalation buffer... we''ll see
"You think that''s air your breathing now?"

This topic is closed to new replies.

Advertisement