/ Renderer


interface Renderer

A generic renderer interface.

The renderer is responsible for making OpenGL calls to render a frame.

GLSurfaceView clients typically create their own classes that implement this interface, and then call GLSurfaceView#setRenderer to register the renderer with the GLSurfaceView.

Developer Guides

For more information about how to use OpenGL, read the OpenGL developer guide.

Threading The renderer will be called on a separate thread, so that rendering performance is decoupled from the UI thread. Clients typically need to communicate with the renderer from the UI thread, because that's where input events are received. Clients can communicate using any of the standard Java techniques for cross-thread communication, or they can use the {GLSurfaceView#queueEvent(Runnable)} convenience method.

EGL Context Lost There are situations where the EGL rendering context will be lost. This typically happens when device wakes up after going to sleep. When the EGL context is lost, all OpenGL resources (such as textures) that are associated with that context will be automatically deleted. In order to keep rendering correctly, a renderer must recreate any lost resources that it still needs. The #onSurfaceCreated(EGLConfig) method is a convenient place to do this.