uncle Lem
uncle Lem

Reputation: 5024

How to use two BitmapTextureAtlases in AndEngine?

I have to work with big textures in my project so I can't put all the textures into the one BitmapTextureAtlas. I tried to put them into two atlases:

textureAtlas  = new BitmapTextureAtlas(2048, 2048, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
textureAtlas2 = new BitmapTextureAtlas(1024, 2048, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
foo = BitmapTextureAtlasTextureRegionFactory.createFromAsset(textureAtlas ,this,"foo.png",0,0);
bar = BitmapTextureAtlasTextureRegionFactory.createFromAsset(textureAtlas2,this,"bar.png",0,0);

But when I try to use bar

Sprite sBar = new Sprite(0,0,bar);
scene.attachChild(sBar);

the only thing I can see is the white rectangle instead of my image. And I have no idea what is wrong here.

Upvotes: 0

Views: 886

Answers (1)

uncle Lem
uncle Lem

Reputation: 5024

OK, I got it. I just forgot about this:

getEngine().getTextureManager().loadTexture(textureAtlas2);

Upvotes: 1

Related Questions