Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Do you have any sample codes of open gl project that shifts the u ,v cordinates .It would be very helpfull, Advance thanks –  Renjith K N Oct 10 '12 at 6:26
    
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. –  OriginalDaemon Oct 11 '12 at 10:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.