【问题标题】:AndEngine GLES 2 - Defenetly unload/remove BitmapTextureAtlas from OpenGL ContextAndEngine GLES 2 - 从 OpenGL 上下文中明确地卸载/删除 BitmapTextureAtlas
【发布时间】: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


    【解决方案1】:

    您可以编写自己的 bitmaptextureatlas,它会覆盖 unload 方法并立即调用它,而不仅仅是在 updatehandler 的下一个滴答声中调用它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-21
      • 2020-10-13
      • 2010-09-16
      • 2014-04-04
      相关资源
      最近更新 更多