When i run the texturepacker in libgdx i have the problem that it doesn't pack all the images in one big sprite sheet. If i for example have 4 images and it only packs 3 of them. Note that 2 images are the exact copies of eachother so maybe that has something to do with it.
Asked
Active
Viewed 304 times
1
-
I curious - why do you need 2 exactly the same images? – MilanG Jul 29 '19 at 07:42
-
I repeat a frame in a walk cycle animation. Unless i'm doing something wrong, i'm new to animation. So yeah maybe its not necessary to use exact copies of images. – syclone Jul 30 '19 at 17:58
-
There must be a way to re-use image. I'm animating object on my own, but no matter what way you are creating animations there must be some solution to avoid double images... – MilanG Jul 31 '19 at 11:52
-
Yeah, actually you can just leave it alone. Aliasing is on by default in TexturePacker. It will still give you all your frames of animation when you load it in the game. There will be separate TextureRegions referring to the same region of the atlas. – Tenfour04 Jul 31 '19 at 12:48
2 Answers
2
LibGDX by default doesn't pack images which are exact copies. This can be overridden by setting alias
to false
in your configuration.
alias: If true, two images that are pixel for pixel the same will only be packed once. (default: true)
However, usually it is beneficial to pack the same images only once because it creates a smaller texture. You can still use both names when getting TextureRegion
objects or creating Sprite
.

Genhis
- 1,484
- 3
- 27
- 29
-
Do you mean with configuration the atlas file that is generated? I have tried to put (alias: true) inside that but it gives an error. So i'm not shure where the configuration is located. – syclone Jul 28 '19 at 07:10
-
Nevermind figured it out. Yust used a Settings class and asigned alias to false and asigned that to the TexturePacker.process() – syclone Jul 28 '19 at 07:43
-
Yeah, you need to use `Settings` class or `pack.json` created in the directory with images to pack. – Genhis Jul 28 '19 at 09:53