Code example for GL10

Methods: glFrustumf, glLoadIdentity, glMatrixMode, glViewport

0
        gl.glColorPointer(4, GL_FLOAT, 0, mColorBuffer);
        gl.glDrawElements(GL_LINES, 6, GL_UNSIGNED_BYTE, mIndexBuffer);
    } 
 
    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