OpenGL 渲染模型
設置當前OpenGLEs 的渲染模式
setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
-
RENDERMODE_CONTINUOUSLY(默認)
會不停 的刷新當前界面
-
RENDERMODE_WHEN_DIRTY
只有當請求渲染的時候才會重新渲染. requestRender() 的時候才會渲染.
類似于懶加載.
只有當調用 GLSurfaceView.requestRender() 時,重新繪制界面
一般設置為 RENDERMODE_WHEN_DIRTY , 讓 GPU 不是都處于高速運轉狀態(tài),從而提高整體的性能.
源碼注釋
/*
* The renderer only renders
* when the surface is created, or when {@link #requestRender} is called.
* public final static int RENDERMODE_WHEN_DIRTY = 0;
*
* The renderer is called
* continuously to re-render the scene.
public final static int RENDERMODE_CONTINUOUSLY = 1;
*/