We’ve reached the end of my graphics optimisation series. To wrap things up I’ll be talking about the power-of-two rule.

Typically GPUs like to deal with textures that have both a width and height that is an exact power-of-two. What does this mean? Well, put simply, each width and height should be “8”, “16”, “32”, “64”, “128”, “256”, “1024” or “2048” pixels in length. Both dimensions don’t necessarily need to be the same length. For example, you could have a texture that is 64×128 pixels in size. Small texture sizes will be rendered by the GPU faster, so try to keep your images as small and optimised as possible.

It’s also useful to understand that spilling over by even 1 pixel will incur a performance hit. For example, a 65×64 sized texture will be the same as a 128×64 sized texture. A 65×65 texture will actually be handled by the GPU as if it were a 128×128 pixels in size. Basically it’ll take slightly longer to render the texture and also consume more memory.

You can avoid these issues by packing your textures into a single texture atlas, which is a large single “super-texture” that will be efficiently handled by the GPU for you. Of course the texture atlas itself will need to be sized to the power-of-two, but the individual frames of animation stored within the atlas don’t need to be.


I really hope you’ve enjoyed this series.

Using simple but effective bitmap reduction techniques can really save the day, especially if you’re starting to run out of memory. Using all techniques covered in my series, I was able to save two texture atlases worth of bitmaps. As each atlas was 2048×2048 pixels in size, that’s quite an enormous saving! So if you’re working on a sprite-based game, give these techniques a try and hopefully they’ll work for you too.

I’ve included at the top of this post a screen capture from the current build of Dare the Monkey. It’s laced with many of the optimisations I’ve talked about but you’ll be very hard pressed to see any degradation in the final image quality. So don’t be afraid to make compromises and optimisations to your artwork to save memory and improve performance. Honestly, 99.99% of gamers will never notice.