Sprite-Animation with OpenGL
The same way sprite animation works in any other API? Draw textures to the screen and every so often change the texture to make it look like the sprite is moving... a better question is if you''re going to do sprite animation, why use a 3D graphics API at all?
he might want to have 2d sprites in a 3d world. with sprites, you can thousands of people and have a decent frame rate where as models tend to get insainly slow when the get into the thousands. -PmanC
Sprite animation is usually done with a class that contains structures for storing sprites and some basic information about the sprite, functions for timing between frames (you don''t always want the sprite frames to change at the same speed as your overall fps), and a function that swaps the texture structure you are using to draw with one containing the next sprite frame. Some sprite classes operate seperately from the rest of the program, calculating the fps and frame flipping of the sprites automatically, or you can have more direct and variable control over the sprite animation and call timers and other member functions on your own. For most applications, an automatic sprite animating class works fine.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement