我将纹理映射到球体,当我倾斜设备时,应该将另一个纹理映射到球体,并且应该从内存中删除前一个纹理。
//Handles the texture
currentSphereTexture = new Texture("sphereTexture", R.drawable.rsz_01);
TextureManager.getInstance().addTexture(currentSphereTexture);
//Creation of a sphere geometry
currentSphereMaterial = new Material();
currentSphereMaterial.addTexture(currentSphereTexture);
currentSphereMaterial.setColorInfluence(0);
//Create the mesh (actual object)
currentSphere.setMaterial(currentSphereMaterial);
我用新的纹理更新球体:
currentSphereMaterial.addTexture(texture);
currentSphereMaterial.removeTexture(currentSphereTexture);
但最终它仍然会导致 Out Of Memory 异常。我怎样才能正确释放纹理,以便它一次只在球体上投射一个纹理?