Black square for some device instead of my animation sprite

Some devices, display a black square instead of my animation. It works fine on my tablette and on emulator, but some friends of me get this black square, it s an animation who take 512 x 512 image source of the original 4608x512 PNG. Next i scale the picture with the screen size.

Display bug but it works for the rest, we can play and the black square know his bound because we can click on it

I display it like this :

Game1.spriteBatch.Draw(texture, new Rectangle((int)this.position.X, (int)this.position.Y, sourceRectangle.Width, sourceRectangle.Height), sourceRectangle, Color.White, 0.0f, new Vector2(0, 0), SpriteEffects.None, 1.0f);

Is there something to do to make it works on all devices ?

That’s a large and non-power-of-two texture. Many devices won’t support that, which could explain the black square. For maximum compatibility I’d recommend sticking with power of two dimensions of 2048 or less. You might get away with 4096x512, but there will be some devices that complain. Hopefully you have texture packing software that will make this change easy for you! :smile:

Here’s some more detailed information regarding texture sizes supported on different devices:

Thanks bro :slight_smile: ! I understand 100% now :slight_smile:

1 Like