Game Development Reference
In-Depth Information
Do we create separate textures for all the other images as well? No. We create a single texture
atlas. It turns out that everything else fits nicely in a single 512×512 pixel atlas, which we can
load as a single texture—something that will make the GPU really happy, since we only need
to bind one texture for all game elements, except the background and help screen images.
Figure 9-15 shows the atlas.
The image in Figure 9-15 is 512×512 pixels in size. The grids and red outlines are not part of the
image, and the background pixels are transparent. This is also true for the black background
pixels of the UI labels and the bitmap font. The grid cells are 32×32 pixels in size. The cool thing
about using a texture atlas like this is that if you want to support higher-resolution screens,
you don't need to change anything but the size of this texture atlas. You can scale it up to
1024×1024 pixels with higher-fidelity graphics and, even though your target was 320×480,
OpenGL ES gives you the better graphics with no game changes!
Figure 9-15. The mighty texture atlas
We placed all the images in the atlas at corners with coordinates that are multiples of 32. This
makes creating texture regions easier.
 
Search WWH ::




Custom Search