3-D scenes can be rendered in two ways. Orthographic projections place the elements in a box, where coordinates are not changed to accommodate the perspective of the viewer. Perspective projections modify the display to simulate the position of the elements in relation to the position of the viewer. For example, two parallel lines (like railroad tracks) stay parallel in orthographic projections, but seem to connect at a distance in perspective projections.
Comparing Projections
To set up a perspective scene in JSL, send the Perspective command to a display list.
Perspective (angle, near, far)
where angle is the viewing angle, near is the distance to the near plane, and far is the distance to the far plane, as illustrated in the drawing above. A couple of things need to be remembered when defining the viewing space.
Items outside the viewing space (for example, closer than the near plane or farther than the far plane) are not drawn. They are clipped off.
The ratio of far to near needs to be small so that the rendering engine can effectively determine which items should be drawn “on top of” other items, simulating closeness of items. The near argument must be greater than zero.
Changing the Perspective
As an alternative to the Perspective command, you can define the actual viewing frustum with the Frustum command.
Frustum(left, right, bottom, top, near, far);
The frustum's viewing volume is defined by (left, bottom, near) and (right, top, near) which specify the (x, y, z) coordinates of the lower left and upper right corners of the near clipping plane; near and far give the distances from the viewpoint to the near and far clipping planes.
Ortho(left, right, bottom, top, near, far)
Ortho2D (left, right, bottom, top)