Methods Summary |
---|
private boolean | detectOpenGLES20()
ActivityManager am =
(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
ConfigurationInfo info = am.getDeviceConfigurationInfo();
return (info.reqGlEsVersion >= 0x20000);
|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
mGLSurfaceView = new GLSurfaceView(this);
if (detectOpenGLES20()) {
// Tell the surface view we want to create an OpenGL ES
// 2.0-compatible
// context, and set an OpenGL ES 2.0-compatible renderer.
mGLSurfaceView.setEGLContextClientVersion(2);
mRenderer = new GLES20TriangleRenderer(this);
mGLSurfaceView.setRenderer(mRenderer);
} else {
throw new IllegalStateException("Can't find OGL ES2.0 context");
}
setContentView(mGLSurfaceView);
|
protected void | onPause()
// Ideally a game should implement onResume() and onPause()
// to take appropriate action when the activity looses focus
super.onPause();
mGLSurfaceView.onPause();
|
protected void | onResume()
// Ideally a game should implement onResume() and onPause()
// to take appropriate action when the activity looses focus
super.onResume();
mGLSurfaceView.onResume();
|
public boolean | onTouchEvent(android.view.MotionEvent event)
Log.i("motion", event.toString());
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
mRenderer.toggleDepthTest();
}
return true;
|