How can I optimize my BitmapTextureAtlas in AndEngine?

Currently, I have 4 different images that I upload to 4 separate BitmapTextureAtlas's. What I would like to do is upload 4 different images inside 1 BitMapTextureAtlas to try and optimize speed. I edited the code the way I think it should have made it work, but when it (Live Wallpaper) loads the texture, the screen is just white. Here is what I have done so far:

onLoadResources ()

Original BitmapTextureAtlas:

this.StarsAtlas = new BitmapTextureAtlas(1024, 1024, TextureOptions.DEFAULT);   
this.SpaceAtlas = new BitmapTextureAtlas(1024, 1024, TextureOptions.DEFAULT);
this.CloudsAtlas = new BitmapTextureAtlas(1024, 1024, TextureOptions.DEFAULT);
this.SunetAtlas = new BitmapTextureAtlas(1024, 512, TextureOptions.DEFAULT);

I shortened to:

this.skyAtlas = new BitmapTextureAtlas(1024, 4096, TextureOptions.BILINEAR);

Original texture areas:

    this.LayerStars = BitmapTextureAtlasTextureRegionFactory 
            .createFromAsset(this.StarsAtlas, this,
                    "stars.jpg", 0, 0); //568x518
    this.LayerSpace = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.SpaceAtlas, this,
                    "space.jpg", 0, 0); //500x800
    this.LayerClouds = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.CloudsAtlas, this,
                    "clouds.jpg", 0, 0); //600x478
    this.LayerSunset = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.SunsetAtlas, this,
                    "sunset.jpg", 0, 0); //997x460

I changed to:

    this.LayerStars = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.skyAtlas, this,
                    "stars.jpg", 0, 0); //568x518
    this.LayerSpace = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.skyAtlas, this,
                    "space.jpg", 0, 518); //500x800
    this.LayerClouds = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.skyAtlas, this,
                    "clouds.jpg", 0, 1318); //600x478
    this.LayerSunset = BitmapTextureAtlasTextureRegionFactory
            .createFromAsset(this.skyAtlas, this,
                    "sunset.jpg", 0, 1796); //997x460

Texture loading:

this.mEngine.getTextureManager().loadTexture(
            this.skyAtlas);

... Later in onLoadScene () This remains unchanged:

    Sprite starSprite = new Sprite(0, 0, 568, 518, this.LayerStars);
    Sprite cloudSprite = new Sprite(0, 0, 600, 478, this.LayerClouds);
    Sprite spaceSprite = new Sprite(0, 0, 500, 800, this.LayerSpace);
    Sprite sunsetSprite = new Sprite(0, 0, 997, 460, this.LayerSunset);

, ? , 4 4 BitmapTextureAtlas.

+3
1

, , , . TextureOptions.DEFAULT TextureOptions.BILINEAR? Theturtleboy AndEngine JPEG , . . http://www.andengine.org/forums/development/jpeg-support-t26.html

+2

All Articles