SFML community forums

Help => Graphics => Topic started by: Somnia on March 23, 2010, 10:44:39 am

Title: Any advice on optimal sprite rendering?
Post by: Somnia on March 23, 2010, 10:44:39 am
Hi,

I'm just designing my systems for things like tilesets and animated sprites. I'm wondering if there any guidelines for how best to set up your sf::Images. Is there likely to be any disadvantage in having every frame of animation in a separate image/texture? Alternatively I could use subrects and have say one animation cycle per texture, This would probably end up being around 512 x 512, but wih a bit of empty space. Is that a good size?

It's possible this kind of thing is completely hardware dependent, or that I'll never tell the difference for a modest number of sprites.
Title: Any advice on optimal sprite rendering?
Post by: Laurent on March 23, 2010, 11:15:10 am
Quote
Is there likely to be any disadvantage in having every frame of animation in a separate image/texture?

Yes, this will end up activating a new OpenGL texture every time the animation is updated, which is really bad. Using less images is always better.

Quote
This would probably end up being around 512 x 512, but wih a bit of empty space. Is that a good size?

Yes, it should be supported even by the oldest graphics cards :)