Code example for GL10

Methods: glActiveTexture, glDisable, glFrustumf, glLoadIdentity, glMatrixMode, glViewport

0
 
        mWorld.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, 2, 12);
 
        /* 
         * By default, OpenGL enables features that improve quality 
         * but reduce performance. One might want to tweak that 
         * especially on software renderer. 
         */ 
        gl.glDisable(GL10.GL_DITHER);
        gl.glActiveTexture(GL10.GL_TEXTURE0);
    } 
 
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        // Nothing special, don't have any textures we need to recreate. 
    }