Using an atlas

As I have mentioned already, texture memory is one of your core resources. In fact, it is common to run out of memory because of all the textures required to animate a typical 2D game. It is also time-consuming to load individual textures rather than loading on a larger texture. So, we have to come up with methods to use texture memory more efficiently.

One common technique designed to pack more textures into less space is known as atlasing. A texture atlas works much like a sprite sheet described earlier in this chapter. Instead of storing each texture as its own image, we pack all of the textures for the entire game into one or more textures known as atlases.

As the word suggests, an atlas works much like a map. We simply need to ...

Get OpenGL Game Development By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.