Sign in to follow this  
Degorath

OpenGL Animating Characters in OpenGL

Recommended Posts

Hi. Me again. Yet another question concerning the Bubble Bobble clone I'm making in C++. I'm rather new to Making games (Other than board games) so excuse me for asking all the basics. Currently the character is a quad which cycles through textures as he walks. So in frame one he would be standing still, when pressing right he would first display the texture where he just starts walking then in the next frame he would be walking a bit further. Am I making any sense at all? So basically what I'm asking is HOW do you animate in OpenGL, am I on the right path?

Share this post


Link to post
Share on other sites
You're on the right path. Just make sure you don't actually load each texture every time you switch between them.

Share this post


Link to post
Share on other sites
That sounds reasonable, although it might be slightly better to just keep all the animations on one texture and set the texture coordinates according to the current animation frame.

Share this post


Link to post
Share on other sites
I'd suggest you to put every frame of an animation in the same texture. As you animate, you'll only have to update your texture coordinates to focus on the current frame. This way, you'll avoid the costy texture change.

Share this post


Link to post
Share on other sites
Yes, what other said are correct. You're on the right track with how you're doing it.

They're even more correct on using all your frames on one texture if at all possible. A fairly costly change in OpenGL is binding/re-binding textures, so if your animations are all on the same texture, you can just bind the quad with different texture coords and save the costly change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this