I'm following a book about libgdx and I haven't comprehend texture atlases as I would like to. As far as I understood, Texture Packer creates one huge image with all textures and atlas or pack file. But when I run it it creates atlas/pack file and than stores all the images one by one. I end up with the same number of images as I stared with, therefore I have done nothing. Why is that happening? What additional option needs to be checked, so I can create one huge file of images? I used this texture packer https://code.google.com/p/libgdx-texturepacker-gui/
Asked
Active
Viewed 713 times
0
-
What size are your source images, and can you post your configuration json file? – Tenfour04 Jan 06 '16 at 02:04
-
Sorry for late reply. The size of images was too big for my settings, and therefore it could only stuff one image in the atlas. Silly me... – potato Jan 08 '16 at 09:43
1 Answers
2
I would not use the Texture Packer GUI as it is easier and faster to pack textures from source. If you work with eclipse, you can do the following.
- Make
raw-assets
folder inside yourandroid/assets
folder and copy your images there - Make
pack
folder inside yourandroid/assets
folder Create a new class on the Desktop project and copy this code
public class TextureSetup { static String input = "../android/assets/raw-assets"; static String output = "../android/assets/pack/"; static String atlas = "my-assets"; public static void main(String[] args){ TexturePacker.process(input, output, atlas); } }
Run as java app
If you use gradle and the TexturePacker class is not found, add gdx-tools to your build.gradle
file.
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
Refer to the official doc on Texture Packer for more info and options https://github.com/libgdx/libgdx/wiki/Texture-packer

kinematic
- 443
- 3
- 5
-
This is a nice approach. My original problem was the size of images I wanted to pack. They were to big for standard settings. – potato Jan 08 '16 at 09:45