# Why some textures become black in GDX

I have such situation in my GDX game: I have a static class that manage my Drawables. It's a Singleton. I want to load all my Textures to it in order not to load them at every turn when I switch between screens (I know this is bad practice but I need this). I pack my resources into a TextureAtlas and load them. But when I pack and load more then some amount of Textures and try to use them some of them become black. Why this is happens? How can I bypass this unfortunate case. The size of my TextureAtlas (four images and one .txt file) is about 4MB.

• I suggest that you learn to use a graphics debugger. The OpenGL debuggers are jokes compared to the D3D debugger, but there's some half-usable options: opengl.org/wiki/Debugging_Tools . Not using a graphics debugger is as silly as not using a code debugger: it's like trying to run a marathon with your shoes tied together. – Sean Middleditch Sep 6 '16 at 18:38
• You know that texture sizes mostly need to be a power of 2 – Bálint Oct 15 '16 at 6:53

https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Textures

Read this and especially Hardware Limitations part. Each phone/pc has it's max_texture_size and if exceeded - will print a black texture.

If you have bad texture coordinates this can happen. But it could be your texture atlas itself is wrong or you even try to use the wrong atlas. So check that as well.

Well. I hope this will help somebody. Some of my textures were black because of their resolution. The resolution of one of them was something about 1200x2400 pixels. If you have similar problem, try to juts decrease resolution of textures.

• Please accept your own answer if that makes sense. – Engineer Sep 20 '17 at 5:25

I was also getting a black square when trying to draw some of the textures on IOS. It turns out the problem was that I was using MipMap and the image sizes were not a power of 2.

texture.setFilter(Texture.TextureFilter.MipMap, Texture.TextureFilter.Nearest);


OpenGL ES 2.0 support non-power-of-two images, but not for everything. Specifically, it does not require support for repeat or mipmap with non-power-of-two textures. If you require those features, you should use power-of-two images