Creating a parallel view with glOrtho

Hello,

I’ve got a problem:

Currently I do this in the reshape method of GLAutodrawable:

		
		/* Setup the projection matrix. */
		gl.glMatrixMode( GL.GL_PROJECTION );
		gl.glLoadIdentity();

		final Camera3D camera = getCamera();

		final double fov    = Math.toDegrees( camera.getAperture() );
		final double aspect = width/height;
		final double near   = _frontClipDistance;
		final double far    = _backClipDistance;
		final double zoom = camera.getZoomFactor();
		final GLU glu = new GLU();
		if ( _projectionPolicy == Projector.PERSPECTIVE )
		{
			glu.gluPerspective( fov , aspect , near , far );
		}
		else{
			gl.glOrtho( -width /2.0,width/2.0,-height/2.0,height/2.0 , near , far);
		}

The only thing I do in the init() method is this:

		/* Enable depth buffering. */
		gl.glEnable( GL.GL_DEPTH_TEST );
		gl.glDepthFunc( GL.GL_LEQUAL );

The Perspective view is 100% correct, but the Parallel view appears way too small, about 1/4-5th of what it’s supposed to be. I know what it’s supposed to be because the same model/view is implemented already in java3d and java2d. I’ve tried a bunch of options, but none seem to work.

Can anyone help me with this?

Your code looks correct; have you tried taking out the division by 2.0 of both width and height in your glOrtho call? Depending on how you’ve defined your aperture (as a half angle or full angle) maybe you’re off by a factor of two there.