Example usage for com.badlogic.gdx.graphics GL10 glFrustumf

List of usage examples for com.badlogic.gdx.graphics GL10 glFrustumf

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL10 glFrustumf.

Prototype

public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar);

Source Link

Usage

From source file:org.interreg.docexplore.reader.gfx.Camera.java

License:Open Source License

public void setup() {
    GL10 gl = Gdx.gl10;
    gl.glMatrixMode(GL10.GL_PROJECTION);
    gl.glPushMatrix();/*from  w  ww  .j  ava  2s . c om*/
    gl.glLoadIdentity();
    gl.glFrustumf(-.25f, .25f, -.25f, .25f, .25f, 100f);

    gl.glMatrixMode(GL10.GL_MODELVIEW);
    gl.glPushMatrix();
    gl.glLoadIdentity();

    double[] buf = Math3D.getVector3d(), up = Math3D.getVector3d();
    Math3D.crossProduct(Math3D.basej, dir, buf);
    Math3D.crossProduct(dir, buf, up);
    Math3D.normalize(up, up);

    position.set((float) eye[0], (float) eye[1], (float) eye[2]);
    target.set((float) (eye[0] + dir[0]), (float) (eye[1] + dir[1]), (float) (eye[2] + dir[2]));
    cup.set((float) up[0], (float) up[1], (float) up[2]);
    model.setToLookAt(position, target, cup);
    //      Gdx.glu.gluLookAt(gl, (float)eye[0], (float)eye[1], (float)eye[2], 
    //         (float)(eye[0]+dir[0]), (float)(eye[1]+dir[1]), (float)(eye[2]+dir[2]), 
    //         (float)up[0], (float)up[1], (float)up[2]);

    Math3D.freeVector3d(buf);
    Math3D.freeVector3d(up);
}