How to use two two BitmapTextureAtlases in AndEngine?

Problems with Canvas, OpenGL, etc...

How to use two two BitmapTextureAtlases in AndEngine?

Postby uncle Lem » Mon Jul 16, 2012 11:03 am

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:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. textureAtlas  = new BitmapTextureAtlas(2048, 2048, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  2. textureAtlas2 = new BitmapTextureAtlas(1024, 2048, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  3. foo = BitmapTextureAtlasTextureRegionFactory.createFromAsset(textureAtlas ,this,"foo.png",0,0);
  4. bar = BitmapTextureAtlasTextureRegionFactory.createFromAsset(textureAtlas2,this,"bar.png",0,0);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

But when I try to use bar this way:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Sprite sBar = new Sprite(0,0,bar);
  2. scene.attachChild(sBar);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

the only thing I can see is the white rectangle instead of my image. And I have no idea what is wrong here.
uncle Lem
Freshman
Freshman
 
Posts: 2
Joined: Mon Jul 16, 2012 10:57 am

Top

Re: How to use two two BitmapTextureAtlases in AndEngine?

Postby uncle Lem » Mon Jul 16, 2012 11:20 am

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

getEngine().getTextureManager().loadTexture(textureAtlas2);
uncle Lem
Freshman
Freshman
 
Posts: 2
Joined: Mon Jul 16, 2012 10:57 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests