Skip to content
DrJonki edited this page Sep 3, 2014 · 1 revision

Texture atlas behaves much like a normal texture, but it can instead store multiple different images in one file. The atlas is loaded using an XML file created with ShoeBox, instead of a regular image.

Texture atlas' are mainly used in batching to be able to use different textures during one draw call.


A simple atlas file should look like this:

<TextureAtlas imagePath="atlas.png">
	<SubTexture name="img1" x="123" y="123" width="100" height="100"/>
	<SubTexture name="img2" x="456" y="456" width="100" height="100"/>
</TextureAtlas>

Where

  • imagePath - A path to the image, relative to the xml file.
  • name - Name of the sub image. You'll use this to refer to the right texture in code.
  • x - The X coordinate of the top-leftmost pixel.
  • y - The Y coordinate of the top-leftmost pixel. The origin of the image is in the top-left.
  • width - Width of the sub image.
  • height - Height of the sub image.

Clone this wiki locally