Search code examples
javalibgdxtexturepackertexture-atlas

Loading correct texture from Atlas with multiple pages


I have a big set of images saved in one atlas, but due to the 2048*2048 size limitation of a single page I had to split my packs in 12 pages.

My problem is that when I use atlas.findRegion(imageName).getTexture() to load the texture, it loads the whole 2048*2048 page and not the single texture inside the page (the image pack contains the correct image though, so I know it's loading the correct file, I just don't understand why it's not cropping the texture around the image I pass as parameter to findRegion).

Thanks in advance, hope the question is detailed enough to receive an answer.


Solution

  • The problem was actually calling the getTexture() method, I just needed to load the Region. More info here loading regions of textureatlas in libgdx loads the entire file