Code example for GL10

Methods: glFrustumfglLoadIdentityglMatrixModeglViewport

0
        // Do nothing special. 
    } 
 
    public void onSurfaceChanged(GL10 gl, int w, int h) {
        // Compute the projection matrix 
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
 
        // Compute the boundaries of the frustum 
        float fl = (float) (-(w / 2)) / 288;
        float fr = (float) (w / 2) / 288;
        float ft = (float) (h / 2) / 288;
        float fb = (float) (-(h / 2)) / 288;
 
        // Set the view frustum 
        gl.glFrustumf(fl, fr, fb, ft, 1.0f, 2000.0f);
 
        // Set the viewport dimensions 
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glViewport(0, 0, w, h);
    } 
 
    public void onDrawFrame(GL10 gl) {
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);