目前我有4个不同的图像,我将其加载到4个单独的BitmapTextureAtlas中。 我想做的是在1 BitMapTextureAtlas中加载4个不同的图像来尝试优化速度。我已经编辑了我认为应该使其工作的代码但是当这个(动态壁纸)加载纹理时,屏幕只是白色。以下是我到目前为止所做的事情:
onLoadResources()
原始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);
我已经缩小到:
this.skyAtlas = new BitmapTextureAtlas(1024, 4096, TextureOptions.BILINEAR);
原始纹理区域:
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
我已改为:
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
加载纹理:
this.mEngine.getTextureManager().loadTexture(
this.skyAtlas);
...稍后在 onLoadScene()中 这保持不变:
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个单独的BitmapTextureAtlas中有4个不同的图像时,它加载得很好。
答案 0 :(得分:2)
我唯一能看到的是你正在使用不同的纹理选项。您是否尝试过TextureOptions.DEFAULT而不是TextureOptions.BILINEAR? AndEngine论坛上的theturtleboy在使用相同设置的JPEG时遇到了一些问题。见http://www.andengine.org/forums/development/jpeg-support-t26.html