Code example for GLSurfaceView

Methods: setEGLConfigChoosersetEGLContextClientVersionsetRenderer

0
public class StencilTest 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);
            // Request an 565 Color buffer with 16-bit depth and 8-bit stencil 
            mGLSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
            mGLSurfaceView.setRenderer(new StencilTestRenderer(this));
        }  
        else 
        { 
        	Log.e("StencilTest", "OpenGL ES 2.0 not supported on device.  Exiting...");
        	finish();