public static interface LegacyGLSurfaceView.Renderer
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 LegacyGLSurfaceView.setRenderer(com.telenav.map.engine.LegacyGLSurfaceView.Renderer) to
register the renderer with the GLSurfaceView.
For more information about how to use OpenGL, read the OpenGL developer guide.
LegacyGLSurfaceView.queueEvent(Runnable) convenience method.
onSurfaceCreated(javax.microedition.khronos.opengles.GL10, javax.microedition.khronos.egl.EGLConfig) method
is a convenient place to do this.| Modifier and Type | Method and Description |
|---|---|
void |
onDrawFrame(javax.microedition.khronos.opengles.GL10 gl)
Called to draw the current frame.
|
void |
onSurfaceChanged(javax.microedition.khronos.opengles.GL10 gl,
int width,
int height)
Called when the surface changed size.
|
void |
onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl,
javax.microedition.khronos.egl.EGLConfig config)
Called when the surface is created or recreated.
|
void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl,
javax.microedition.khronos.egl.EGLConfig config)
gl - the GL interface. Use instanceof to
test if the interface supports GL11 or higher interfaces.config - the EGLConfig of the created surface. Can be used
to create matching pbuffers.void onSurfaceChanged(javax.microedition.khronos.opengles.GL10 gl,
int width,
int height)
void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
// for a fixed camera, set the projection too
float ratio = (float) width / height;
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
}
gl - the GL interface. Use instanceof to
test if the interface supports GL11 or higher interfaces.width - height - void onDrawFrame(javax.microedition.khronos.opengles.GL10 gl)
void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
//... other gl calls to render the scene ...
}
gl - the GL interface. Use instanceof to
test if the interface supports GL11 or higher interfaces.