Jump to content
  • Advertisement
Sign in to follow this  
HalfLucifer

OpenGL Looking for better methods for 2d animation in a packed image

This topic is 4419 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

Sorry for my novice question that might appear once in a while. I did search up forums but failed to find a thread that have detailed explanation about it. I noticed that many 2d games packed sprite animations into one big image file which is none-power-of-two dimension. However, using glBindTexture() on a NPOT texture would kill performance immediately. The method I figure out might work is: (I utilize DevIL to load images) 1) Load the big NPOT image into a data buffer. 2) Use ilCopyPixel() to copy each region of animation frame to individual buffers. 3) Construct a sprite/quad and bind a blank POT texture(32x32, 64x64, etc) on it. 4) Use glTexSubImage2D() to replace the blank texture totally with animation frame buffers as needed. Is there a catch? Currently I target on OpenGL 1.1 only. Is there other method more efficient/effective to do? Texture matrix? Image scaling? Or NPOT extension?

Share this post


Link to post
Share on other sites
Advertisement
Image size and texture size are two different things: you can assemble as few as possible large square textures at runtime after loading many small and rectangular sprite filmstrips. (Or you can preprocess game graphics to avoid repeating work with the player waiting.)
Both switching textures and altering them are somewhat expensive operations that can be avoided; using a constant large texture atlas should be faster.

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!