2
\$\begingroup\$

I'm trying to use a TextureAtlas for all my textures for better performance. Every time my game starts all my tiles are packed into one texture atlas. I have put following code into my DesktopLauncher class that does that:

TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxWidth = 512;
settings.maxHeight = 512;
settings.filterMin = Texture.TextureFilter.Nearest;
settings.filterMag = Texture.TextureFilter.Nearest;
TexturePacker.process(settings,"blocks","texturePacks","blockPack");
TexturePacker.process(settings,"items","texturePacks","itemPack");

The atlas is loaded with the asset manager and I'm getting the texture region with

atlas.findRegion(..);

It all works, but I have came across an issue. The texture is not filling the whole space anymore. It should fill a 32 by 32 pixel area, but it doesn't. Here is a picture of whats happening:

There are fine blue lines between the tiles and I don't know what I'm doing wrong. My background is blue, if that's helpful information.

I have tried so far:

  • Loading the texture region from the .png file directly -> no blue lines, so it is an issue with the texture packer

  • Changing the texture filters, but no one I have tried helped

Thanks in advance for any comments and answers!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.