目前,我有 4 个不同的图像要加载到 4 个单独的 BitmapTextureAtlas 中。我想做的是在 1 个 BitMapTextureAtlas 中加载 4 个不同的图像以尝试优化速度。我已经将代码编辑为我认为应该可以使它工作的代码,但是当这个(动态壁纸)加载纹理时,屏幕只是白色的。这是我到目前为止所做的:
onLoadResources()
原始位图纹理图集:
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 个不同的图像时,它加载得很好。