Skip to content Skip to sidebar Skip to footer

Andengine Loading Graphics: Why Is My Background Texture Small And Upside Down

Recently, I started working on android 2D game using Andengine on eclipse. When I try to load my background texture, I get this figure on my tablet (zync 930 plus) Here is my cod

Solution 1:

I am guessing that the size of you image is 1024x1024 (background.jpg ) and you are trying to fit in the the atlas texture with the height of 1024 but shifted by 10 ( parameters 0, 10 ).

So please try to replace this:

BitmapTextureAtlasTextureRegionFactory.createFromAsset(mainMenuTextureAtlas,this.activity,"background.jpg",0,10) ;

With this:

BitmapTextureAtlasTextureRegionFactory.createFromAsset(mainMenuTextureAtlas,this.activity,"background.jpg",0,0) ;

i.e: Do not shift by 10 the texture in the atlas if it has exactly the same size

Solution 2:

This usually happens because you are loading a texture (in this case background.jpg) that is bigger than your BitmapTextureAtlas area (1024x1024). Either scale your background image down or increase the size of BitmapTextureAtlas which is not suggested as 1024x1024 should be your max size. Anything bigger you may get a lot of performance issues.

Also as erahal pointed out, you are offsetting your image on the Height attribute of 10 which will cause issues if you are using a 1024x1024 image (size of your BitmapTextureAtlas) -- because your new image will be treated as 1024x1034 instead of 1024x1024 and will throw an error.

Post a Comment for "Andengine Loading Graphics: Why Is My Background Texture Small And Upside Down"