5
\$\begingroup\$

My first question was asked wrong, so I need to ask again :)

I found out, that I will have to do an OpenGL animation for my Android game. The closest (known) example is Talking Tom (but I don't know how they did the animations).

I have large PNGs which I would like to put into a animation. For example - 30 PNGs 427×240px at 8 FPS.

I know some things already about Open GL, but I am used to learn from example code. And it is quicker that way (so I don't need to invent hot water all over again :)). Does anybody has any points to direct me?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

All you have to do is set the correct frame of the animation based on the time since starting the animation. You could try to simply switch the texture, but in order to get better performance you would usually put all frames in one texture and shift the UV coordinates to each frame.

If you wish to learn from some code, I would suggest taking a look at the libgdx source code here. It may also be better for you to simply use that library to handle the graphics for your game.

\$\endgroup\$
2
  • \$\begingroup\$ Do you have any sample codes of open gl project that shifts the u ,v cordinates .It would be very helpfull, Advance thanks \$\endgroup\$ Oct 10, 2012 at 6:26
  • \$\begingroup\$ Just look up one of the many "draw textured polygon" tutorials out there. All you need to do is change those UV coordinates you put into a buffer every time you draw and how you change those coordinates will depend on how you are packing the frames of your animation into a texutre. \$\endgroup\$ Oct 11, 2012 at 10:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .