Code example for GLSurfaceView

Methods: setEGLContextClientVersion, setRenderer

0
public class TextureWrap extends Activity {
    @Override 
    protected void onCreate(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);
            mGLSurfaceView.setRenderer(new TextureWrapRenderer(this));
        }  
        else 
        { 
        	Log.e("TextureWrap", "OpenGL ES 2.0 not supported on device.  Exiting...");
        	finish();          
        } 
        setContentView(mGLSurfaceView);
    }