Code example for GLSurfaceView

Methods: getHolder, setEGLConfigChooser, setRenderer

0
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        // Create our Preview view and set it as the content of our 
        // Activity 
        mGLSurfaceView = new GLSurfaceView(this);
        // We want an 8888 pixel format because that's required for 
        // a translucent window. 
        // And we want a depth buffer. 
        mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
        // Tell the cube renderer that we want to render a translucent version 
        // of the cube: 
        mGLSurfaceView.setRenderer(new CubeRenderer(true));
        // Use a surface format with an Alpha channel: 
        mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
        setContentView(mGLSurfaceView);
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume();