Game Development Reference
In-Depth Information
Listing 2-5. Multiple View OpenGL ES Activity
package robs.demo.TestDemoComplete;
import android.app.Activity;
import android.os.Bundle;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.view.MotionEvent;
import android.util.AttributeSet;
public class OpenGLDemoActivity extends Activity
{
private GLSurfaceView m_GLView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MyGLSurfaceView V = (MyGLSurfaceView)this.findViewById (R.id.MyGLSurfaceView);
m_GLView = V;
}
@Override
protected void onPause()
{
super.onPause();
m_GLView.onPause();
}
@Override
protected void onResume()
{
super.onResume();
m_GLView.onResume();
}
}
////////////////////////////////////////////////////////////////////////////
class MyGLSurfaceView extends GLSurfaceView
{
private final MyGLRenderer m_Renderer;
// Constructor that is called when MyGLSurfaceView is created
// from within an Activity with the new statement.
public MyGLSurfaceView(Context context)
{
super(context);
// Create an OpenGL ES 2.0 context.
setEGLContextClientVersion(2);
Search WWH ::




Custom Search