【发布时间】:2014-05-14 12:45:48
【问题描述】:
我想知道我该怎么做?因为目前我使用BitmapTextureAtlas.unload(),但这不会从 OpenGL 上下文中删除/清除数据。我知道是因为在我卸载了游戏中的每个纹理之后。然后暂停和恢复应用程序,当 OpenGL 重新创建上下文时需要一些时间。
所以我的结论是 OpenGL 上下文仍然包含这些数据。
我的代码
@Override
public synchronized void onPauseGame() {
super.onPauseGame();
if (gameIsLoaded) {
Log.i("textureManager",""+getTextureManager().getTexturesLoadedCount());
Log.i("textureManager",""+getTextureManager().getTextureMemoryUsed());
atlasNumbers.unload();
atlasIcon.unload();
atlasHexagonBackground.unload();
atlasCorner.unload();
atlasCloud.unload();
// there is a lot more of unload
Log.i("textureManager",""+getTextureManager().getTexturesLoadedCount());
Log.i("textureManager",""+getTextureManager().getTextureMemoryUsed());
wasPaused = true;
}
}
输出
I/textureManager﹕ 130
I/textureManager﹕ 79834
I/textureManager﹕ 130
I/textureManager﹕ 79834
我发现BitmapTextureAtlas.unload() 只设置了标志,实际卸载将在下一个 onUpdate 滴答时执行。有没有卸载纹理然后执行应用程序暂停?
【问题讨论】:
标签: java android opengl-es andengine