1-2 OpenGL 渲染模式介绍

OpenGL 渲染模型

设置当前OpenGLEs 的渲染模式

setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
  • RENDERMODE_CONTINUOUSLY(默认)

    会不停 的刷新当前界面

  • RENDERMODE_WHEN_DIRTY

    只有当请求渲染的时候才会重新渲染. requestRender() 的时候才会渲染.

    类似于懒加载.

    只有当调用 GLSurfaceView.requestRender() 时,重新绘制界面

    一般设置为 RENDERMODE_WHEN_DIRTY , 让 GPU 不是都处于高速运转状态,从而提高整体的性能.

源码注释

  /*
         * 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;
         */

你可能感兴趣的:(1-2 OpenGL 渲染模式介绍)