Game Development Reference
In-Depth Information
If the TexturePacker cannot it all the subimages into a single texture, it
will automatically split them up into several texture atlases. However,
there is a chance that the subimages are distributed in an unfavorable
way between these atlases if it creates two textures that will be
switched between frequently, which in turn could have an impact on
render performance.
LibGDX's TexturePacker has a very smart feature to tackle this type
of problem. All you need to do is group the subimages in their own
subfolder in assets-raw . This way TexturePacker will create one
image file per subfolder that belongs to the texture atlas. You have to
use the full path to the subimage if you want to use this functionality;
for example, a subimage assets-raw/items/gold_coin.png
would be referenced as items/gold_coin .
Now you know how to create texture atlases in code. This approach mostly works
very well, but it is not very user friendly in terms of seeing the outcome directly
when a setting or an image is changed in the atlas. Fortunately, there is already a nice
tool called TexturePacker-GUI that has been developed by Aurélien Ribon. This
tool is directly designed for LibGDX to work with its TexturePacker.
Check out the official project website at https://code.google.com/p/libgdx-
texturepacker-gui/ . You can also find more about the offline TexturePacker at
https://github.com/libgdx/libgdx/wiki/Texture-packer .
The following screenshot is taken from the project's website that shows the tool
in action:
 
Search WWH ::




Custom Search