## Changing Camera Settings

To understand the coordinates better, let us experiment with the camera-related methods and see how they affect the triangle that you drew. Remember that these are the points of our triangle: (-0.5,-0.5,0 0.5,-0.5,0 0,0.5,0). The following three camera-related methods yield the triangle as it appears in Figure 10-3:

//Look at the screen (origin) from 5 units away from the front of the screen GLU.gluLookAt(gl, 0,0,5, 0,0,0, 0,1,0);

//Set the height to 2 units and depth to 4 units gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);

Now suppose you change the camera's up vector toward the negative y direction, like this:

If you do that, you'll see an upside-down triangle (see Figure 10-4). If you want to make this change or something like it, you can find the method in the AbstractRenderer.java file.

Figure 10-4. A triangle with the camera upside down

If you use this code to increase the viewing box's height and width by a factor of four as shown here, gl.glFrustumf(-ratio * 4, ratio * 4, -l * 4, l *4, 3, 7);

you will see the triangle shrink because the triangle stays at the same units while our viewing box has grown. This method call appears in the AbstractRenderer.java class (see Listing 10-11). What you see after this change is shown in Figure 10-5.

If you change the camera position so that it looks at the screen from behind, you will see your coordinates reversed in the x-y plane. You can set this up through the following code:

Figure 10-5. A triangle with a viewing box that's four times bigger
0 0