I have an init()
method, and I am trying to create a Perspective
rendering. Below is the code I have so far, but the numbers that I'm passing to gluPerspective(fovy, aspect, zNear, zFar)
are wrong. I think fovy
is the field of view (60 degrees), and aspect
is the aspect ratio (width / height), but I don't know what zNear
and zFar
are.
public void init(GLAutoDrawable gld) {
//We will use the default ViewPort
GL gl = gld.getGL();
glu = new GLU();
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glu.gluLookAt(
25, 15, 0, // eye
25, 15, 30, // at
0, 1, 0 // up
);
// Set up camera for Orthographic projection:
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(60, 500/300, 0.0, 60.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
}