Question

I want load backgound texture from JPG, scale it down to proper size. So I have 1920x1080 picture and I scale it to ~800x480.

BitmapTextureAtlas splashTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 1920, 1080, TextureOptions.DEFAULT);
        splashTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(splashTextureAtlas, this, "new/splash_bg1.JPG", 0, 0);
        splashTextureAtlas.load();

Sprite splash = new Sprite(0, 0, splashTextureRegion, mEngine.getVertexBufferObjectManager());
        splash.setScale(mainScaleX);

And effect is poor.

Orginal File

enter image description here

What I see on screen

enter image description here

I try with diffrent TextureOption but without any effect. Could you suggest me what I'm doing wrong?


UPDATE

Even when I keep aspect ratio quality is poor

enter image description here

Was it helpful?

Solution

By default, dither is disabled for performance reasons. For gradient textures that are experiencing really bad banding, try adding this to your sprite creation:

Sprite splash = new Sprite(0, 0, splashTextureRegion, mEngine.getVertexBufferObjectManager()) {

    protected void preDraw(GLState pGLState, Camera pCamera) {
        super.preDraw(pGlState, pCamera);
        pGlState.enableDither();
    }

};

OTHER TIPS

the problem may be in your scaling - at 1920x1080 you have an aspect ratio of 1.777 - but at 800x480, the aspect ratio is 1.667.

Try scaling the image to 800x450 or 853x480 to preserve the aspect ratio of 1.777 - if you truly need 800x480, then crop the image to those specs after you scale the size down.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top