Code example for GL10

Methods: glLoadIdentity, glMatrixMode, glViewport, gluPerspective

    public void onSurfaceChanged(GL10 gl, int width, int height) {
        if(height == 0) {                         //Prevent A Divide By Zero By
            height = 1;                         //Making Height Equal One
        gl.glViewport(0, 0, width, height);     //Reset The Current Viewport
        gl.glMatrixMode(GL10.GL_PROJECTION);     //Select The Projection Matrix
        gl.glLoadIdentity();                     //Reset The Projection Matrix
        //Calculate The Aspect Ratio Of The Window 
        GLU.gluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f);
        gl.glMatrixMode(GL10.GL_MODELVIEW);     //Select The Modelview Matrix
        gl.glLoadIdentity();                     //Reset The Modelview Matrix
/* ***** Listener Events ***** */     
     * Override the key listener to receive keyUp events. 
     * Check for the DPad presses left, right, up, down and middle.