com.neovisionaries.android.opengl
Class GLESRenderer

java.lang.Object
  extended by com.neovisionaries.android.opengl.GLESRenderer
All Implemented Interfaces:
GLSurfaceView.Renderer

public abstract class GLESRenderer
extends Object
implements GLSurfaceView.Renderer

Renderer for OpenGL ES.

Instances of this class should be set to GLESSurfaceView so that their callback methods such as onKeyDown() can be called.

Author:
Takahiko Kawasaki

Constructor Summary
GLESRenderer()
           
 
Method Summary
 Context getContext()
          Get the context of the GLESSurfaceView to which this renderer is set to.
 void onDrawFrame(GL10 gl10)
          This method calls onDrawFrame(GLES).
abstract  void onDrawFrame(GLES gles)
           
 boolean onKeyDown(GLESSurfaceView view, int keyCode, KeyEvent event)
          Callback method for KeyDown event.
 boolean onKeyLongPress(GLESSurfaceView view, int keyCode, KeyEvent event)
          Callback method for KeyLongPress event.
 boolean onKeyUp(GLESSurfaceView view, int keyCode, KeyEvent event)
          Callback method for KeyUp event.
 void onSurfaceChanged(GL10 gl10, int width, int height)
          This method calls onSurfaceChanged(GLES, int, int).
abstract  void onSurfaceChanged(GLES gles, int width, int height)
           
 void onSurfaceCreated(GL10 gl10, EGLConfig config)
          This method calls onSurfaceCreated(GLES, EGLConfig).
abstract  void onSurfaceCreated(GLES gles, EGLConfig config)
           
 boolean onTouchEvent(GLESSurfaceView view, MotionEvent event)
          Callback method for Touch event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLESRenderer

public GLESRenderer()
Method Detail

onDrawFrame

public final void onDrawFrame(GL10 gl10)
This method calls onDrawFrame(GLES).

Specified by:
onDrawFrame in interface GLSurfaceView.Renderer

onSurfaceChanged

public final void onSurfaceChanged(GL10 gl10,
                                   int width,
                                   int height)
This method calls onSurfaceChanged(GLES, int, int).

Specified by:
onSurfaceChanged in interface GLSurfaceView.Renderer

onSurfaceCreated

public final void onSurfaceCreated(GL10 gl10,
                                   EGLConfig config)
This method calls onSurfaceCreated(GLES, EGLConfig).

Specified by:
onSurfaceCreated in interface GLSurfaceView.Renderer

onDrawFrame

public abstract void onDrawFrame(GLES gles)
                          throws GLESException
Throws:
GLESException

onSurfaceChanged

public abstract void onSurfaceChanged(GLES gles,
                                      int width,
                                      int height)
                               throws GLESException
Throws:
GLESException

onSurfaceCreated

public abstract void onSurfaceCreated(GLES gles,
                                      EGLConfig config)
                               throws GLESException
Throws:
GLESException

getContext

public Context getContext()
Get the context of the GLESSurfaceView to which this renderer is set to.

Returns:
The context of the GLESSurfaceView to which this renderer is set to.

onKeyDown

public boolean onKeyDown(GLESSurfaceView view,
                         int keyCode,
                         KeyEvent event)
Callback method for KeyDown event.

This method is called when the GLESSurfaceView instance which this renderer is set to receives a KeyDown event.

Parameters:
view - The GLESSurfaceView instance which this renderer is set to.
keyCode -
event -
Returns:
True if the implementation of this method has consumed the event.
See Also:
GLESSurfaceView.onKeyDown(int, KeyEvent)

onKeyLongPress

public boolean onKeyLongPress(GLESSurfaceView view,
                              int keyCode,
                              KeyEvent event)
Callback method for KeyLongPress event.

This method is called when the GLESSurfaceView instance which this renderer is set to receives a KeyLongPress event.

Parameters:
view - The GLESSurfaceView instance which this renderer is set to.
keyCode -
event -
Returns:
True if the implementation of this method has consumed the event.
See Also:
GLESSurfaceView.onKeyLongPress(int, KeyEvent)

onKeyUp

public boolean onKeyUp(GLESSurfaceView view,
                       int keyCode,
                       KeyEvent event)
Callback method for KeyUp event.

This method is called when the GLESSurfaceView instance which this renderer is set to receives a KeyUp event.

Parameters:
view - The GLESSurfaceView instance which this renderer is set to.
keyCode -
event -
Returns:
True if the implementation of this method has consumed the event.
See Also:
GLESSurfaceView.onKeyUp(int, KeyEvent)

onTouchEvent

public boolean onTouchEvent(GLESSurfaceView view,
                            MotionEvent event)
Callback method for Touch event.

This method is called when the GLESSurfaceView instance which this renderer is set to receives a Touch event.

Parameters:
view - The GLESSurfaceView instance which this renderer is set to.
event -
Returns:
True if the implementation of this method has consumed the event.
See Also:
GLESSurfaceView.onTouchEvent(MotionEvent)