Jump to content
  • Advertisement
Sign in to follow this  
Degorath

OpenGL Animating Characters in OpenGL

This topic is 4030 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!