ortho(3G)ortho(3G)NAME
ortho, ortho2 - define an orthographic projection transformation
C SPECIFICATION
void ortho(Coord left, Coord right, Coord bottom, Coord top,
Coord near, Coord far)
void ortho2(Coord left, Coord right, Coord bottom, Coord top)
The above routines are functionally the same. They differ only in that
ortho is used for 3-D applications and ortho2 is used for 2-D
applications.
PARAMETERS
left expects the coordinate for the left vertical clipping plane.
right expects the coordinate for the right vertical clipping plane.
bottom expects the coordinate for the bottom horizontal clipping plane.
top expects the coordinate for the top horizontal clipping plane.
near expects the distance to the nearer depth clipping plane.
far expects the distance to the farther depth clipping plane.
DESCRIPTIONortho specifies a box-shaped enclosure in the eye coordinate system that
is mapped to the viewport. left, right, bottom, top, near, and far
specify the location of the x, y, and z clipping planes. near and far are
distances along the line of sight from the eye space origin; the z
clipping planes are at -near and -far.
ortho2 is the 2-D version of ortho. It specifies a rectangle that is
mapped to the viewport. When you use ortho2 with 3-D world coordinates,
the z coordinates are not transformed and will be clipped if they lie
outside the range -1 < z < 1.
When the system is in single matrix mode, both ortho and ortho2 load a
matrix onto the matrix stack, thus replacing the current top matrix.
When the system is in viewing, projection, or texture matrix mode, the
system replaces the current Projection matrix without changing the
ModelView matrix stack or the Texture matrix.
GL window coordinates have integer values at the centers of pixels. Thus
to correctly specify a one-to-one orthographic mapping from eye-
coordinates to window-coordinates, the edges of the viewable volume
should be set to 1/2-pixel values. For example, the 1280 x 1024 full
screen is correctly mapped one-to-one from eye-coordinates to window-
coordinates by the commands:
Page 1
ortho(3G)ortho(3G)
ortho2(-0.5,1279.5,-0.5,1023.5);
viewport(0,1279,0,1023);
Note that ortho, unlike perspective and window, allows the viewpoint to
be moved from the origin of the coordinate system. Thus ortho combines a
trivial viewing transformation (translation from the origin) with its
projection operation. Be sure not to duplicate the orthographic
translation in your viewing transformation.
SEE ALSO
mmode, perspective, viewport, window
Page 2