我在使用精灵作为场景背景时遇到了一些麻烦。我设置的背景如下:Andengine背景图片性能
Sprite bg = new Sprite(SCENE_WIDTH/2 , SCENE_HEIGHT/2, this.mParallaxBackRegion,getVertexBufferObjectManager());
bg.setCullingEnabled(true);
mScene.setBackground(new SpriteBackground(bg));
纹理加载:
this.mParallaxBack = new AssetBitmapTexture(this.getTextureManager(), this.getAssets(), "gfx/_fixed.png", TextureOptions.BILINEAR);
this.mParallaxBackRegion = TextureRegionFactory.extractFromTexture(this.mParallaxBack);
this.mParallaxBack.load();
我加载巴布亚新几内亚是一个全黑的960x640的图像(同我的场景大小),用于测试目的。但是,设置背景会导致我的fps从60(不使用背景时)降至45 HTC Desire。我尝试了多种设置背景的方式,但都似乎造成了相同的性能。为什么这会对性能产生如此激烈的影响,我能做些什么呢?
也许一个愚蠢的问题,但你没有初始化每一帧的纹理,是吗? – Geobits
不,我将它加载到onCreateResources函数中 – user1342037