Andrei Aulaska
Andrei Aulaska

Reputation: 1118

AndEngine GLES2 Low sprite quality after resize

I have a sprite 160x160 pixels (in attachment).

After resize sprite become unclear (right image).

How can I get normal quality (middle image)?

Thanks for help.

BitmapTextureAtlas Texture1 = new BitmapTextureAtlas(null, 1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
mEngine.getTextureManager().loadTexture(Texture1);

ITextureRegion player = BitmapTextureAtlasTextureRegionFactory.createFromAsset(Texture1, this, "player.png", 0, 0);

enter image description here

Upvotes: 1

Views: 2917

Answers (1)

GameDroids
GameDroids

Reputation: 5662

did you try other TextureOptions ? They tell you how the AndEngine will interprete the pixels when resizing. You have the follwing options:

NEAREST <-- pixels are visible
NEAREST_PREMULTIPLYALPHA
REPEATING_NEAREST_PREMULTIPLYALPHA

BILINEAR <-- a little blurred
BILINEAR_PREMULTIPLYALPHA
REPEATING_BILINEAR_PREMULTIPLYALPHA

You currently use BILINEAR_PREMULTIPLYALPHA, but if you don't care about the alpha-channel (transparency) you can simply use the BILINEAR or REPEATING_BILINEAR. Play a little with these settings to find the best for your needs.

If you want to know more, here's a link to a thread in the AndEngine Forum where these Options are explained in more detail.

regards
christoph

Upvotes: 1

Related Questions