Code example for GL10

Methods: glFrustumf, glLoadIdentity, glMatrixMode, glViewport

0
            mCube.draw(gl);
        } 
 
        public void onSurfaceChanged(GL10 gl, int width, int height) {
             gl.glViewport(0, 0, width, height);
 
             /* 
              * Set our projection matrix. This doesn't have to be done 
              * each time we draw, but usually a new projection needs to 
              * be set when the viewport is resized. 
              */ 
 
             float ratio = (float) width / height;
             gl.glMatrixMode(GL10.GL_PROJECTION);
             gl.glLoadIdentity();
             gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
        } 
 
        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
            /* 
             * By default, OpenGL enables features that improve quality 
             * but reduce performance. One might want to tweak that