Android Guides | Samples

Android.Opengl.GLSurfaceView.IRenderer

A generic renderer interface.

See Also: GLSurfaceView+IRenderer

Syntax

[Android.Runtime.Register("android/opengl/GLSurfaceView$Renderer", "", "Android.Opengl.GLSurfaceView/IRendererInvoker")]
public interface GLSurfaceView.IRenderer : IJavaObject, IDisposable

Remarks

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(GLSurfaceView+IRenderer) 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(IRunnable) 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 GLSurfaceView+IRenderer.OnSurfaceCreated(IGL10,EGLConfig) method is a convenient place to do this.

See Also

[Android Documentation]

Requirements

Namespace: Android.Opengl
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 3

The members of Android.Opengl.GLSurfaceView.IRenderer are listed below.

Public Methods

OnDrawFrame(IGL10)
Called to draw the current frame.
OnSurfaceChanged(IGL10, Int32, Int32)
Called when the surface changed size.
OnSurfaceCreated(IGL10, EGLConfig)
Called when the surface is created or recreated.