Code example for GL10

Methods: glLoadIdentity, glMatrixMode, glOrthof, glViewport

0
     * @param width the surface width 
     * @param height the surface height 
     */ 
    public void onSurfaceChanged(GL10 gl, int width, int height) {
 
         gl.glViewport(0, 0, width, height);
 
        float ratio= (float) width / height;
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
 
        if(width > height)
            gl.glOrthof(-ratio, ratio, -1, 1, 1, 10);
        else 
            gl.glOrthof(-1, 1, -1 / ratio, 1 / ratio, 1, 10);
 
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
    } 
 
 
    /** 
     * When a new is drawn