2D Sprites (ortho + textures)
When it comes to animating sprites using OpenGL, which is better?
(A) -- Load up each frame of animation as a separate texture. Use the appropriate texture for the appropriate animation.
(B) -- Load up a singular sprite sheet. Use the appropriate texture coordinates to just slice out the current animation.
Also, if anyone knows the answer: why are textures best with sizes of 2^n? Is it worth concerning myself with this in a simple 2D fighter?
B
and use POT if possible unless you are on a newer Gfx card GL2.0 compliant should have NPOT support.
and use POT if possible unless you are on a newer Gfx card GL2.0 compliant should have NPOT support.
I'd say it depends on how big your sprites are. You would'nt want to try to load a sprite sheet that's say, 8192x8192 into VRAM, as most video cards don't support massive textures. But, if you have smaller, more average size sprites, cramming them into a sprite sheet makes sense. Faster loading, less memory consumption.
I personally use the sprite sheet method, although I do so for organizational reasons. I never considered it a matter of efficiency. I'm not sure which method is more efficient.
As for the power of two issue, just use alpha masking (which you're probably doing anyway). The actual sprite doesn't need to be a power of two, just the rectangle enclosing it. For that matter, if you use a sprite sheet, only the sprite sheet needs to be a power of two. The texture coordinates within the sheet can be anything.
As for the power of two issue, just use alpha masking (which you're probably doing anyway). The actual sprite doesn't need to be a power of two, just the rectangle enclosing it. For that matter, if you use a sprite sheet, only the sprite sheet needs to be a power of two. The texture coordinates within the sheet can be anything.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement