0
\$\begingroup\$

I'm using libGDX and I've switched from using a Texture instance for each wall in my game to an atlas. The wall texture you see was repeated alright: enter image description here

As you can see, it skips textures when I switched to this atlas image (These images are just placeholders):

enter image description here

From what I understood, this happens because the GPU doesn't know about the region's limits - only the atlas'es image. I wonder if there is a way to let the GPU know the repeat should be only in the given region limits? My code:

TextureRegion wallTexture = new TextureRegion(atlas.findRegion("wall"));

    wallTexture.getTexture().setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
    wallTexture.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
\$\endgroup\$
  • \$\begingroup\$ Have you looked into using Array Textures so each texture has its own 0...1 UV space, or performing your wrapping in the fragment shader? \$\endgroup\$ – DMGregory Oct 31 '18 at 11:49
  • \$\begingroup\$ Sorry, the link you provided isn't clear enough for me. From what I understood, manipulating the fragment sha is the way but I failed to write one. Do you maybe have an example? \$\endgroup\$ – Gad Wissberg Dec 21 '18 at 18:16
  • \$\begingroup\$ What did you try and where did it fail? \$\endgroup\$ – DMGregory Dec 21 '18 at 18:32

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.