0
votes

I am trying to animate a sprite with OpenGLES 2 in Android with the artwork contained in a spritesheet. I've thought of two ways to go about it

Method 1. Create a layered sprite, then fade each layer in turn. That is there would be multiple sprites stacked on top of each other, and each sprite would have a lightly different texture. To display the animation the the top layer would turn invisible to reveal the one below. That layer would then turn invisible, etc.

Method 2: Create a sprite then somehow (maybe with a translation matrix?) animate the textures uv coordinates to make the sprite animate.

Is there a standard way to animate sprites in OpenGL?

1

1 Answers

0
votes

Method 2 is the preferred one. Create an spritesheet, with all the sprites of the animation within just one texture and change the uv coordinates accordingly. It avoids changing driver states and moving memory around.

It is commonly referred as sprite atlas.