NAME
glFrustum
- multiply the current matrix by a perspective matrix
C SPECIFICATION
void ggllFFrruussttuumm(
GLdouble _l_e_f_t,
GLdouble _r_i_g_h_t,
GLdouble _b_o_t_t_o_m,
GLdouble _t_o_p,
GLdouble _n_e_a_r___v_a_l,
GLdouble _f_a_r___v_a_l )
delim $$
PARAMETERS
-
_l_e_f_t, _r_i_g_h_t
-
Specify the coordinates for the left and right vertical clipping planes.
-
_b_o_t_t_o_m, _t_o_p
-
Specify the coordinates for the bottom and top horizontal clipping planes.
-
_n_e_a_r___v_a_l, _f_a_r___v_a_l
-
Specify the distances to the near and far depth clipping planes.
Both distances must be positive.
DESCRIPTION
ggllFFrruussttuumm describes a perspective matrix that produces a perspective projection.
The current matrix (see ggllMMaattrriixxMMooddee) is multiplied by this matrix
and the result replaces the current matrix, as if
ggllMMuullttMMaattrriixx were called with the following matrix
as its argument:
down 150
{left [ ~~~ {
down 165 matrix {
ccol { {{2 ~ "near_val"} over {"right" ~-~ "left"}} above 0 above 0 above 0 }
ccol { 0 above {{2 ~ "near_val"} over {"top" ~-~ "bottom"}} ~ above 0 above 0 }
ccol { A ~~~~ above B ~~~~ above C ~~~~ above -1 ~~~~}
ccol { 0 above 0 above D above 0}
}}
~~~ right ]}
down 130
{A ~=~ {"right" ~+~ "left"} over {"right" ~-~ "left"}}
down 130
{B ~=~ {"top" ~+~ "bottom"} over {"top" ~-~ "bottom"}}
down 130
{C ~=~ -{{"far_val" ~+~ "near_val"} over {"far_val" ~-~ "near_val"}}}
down 130
{D ~=~ -^{{2 ~ "far_val" ~ "near_val"} over {"far_val" ~-~ "near_val"}}}
Typically, the matrix mode is GGLL__PPRROOJJEECCTTIIOONN, and
(_l_e_f_t, _b_o_t_t_o_m, -_n_e_a_r___v_a_l) and (_r_i_g_h_t, _t_o_p, -_n_e_a_r___v_a_l)
specify the points on the near clipping plane that are mapped
to the lower left and upper right corners of the window,
assuming that the eye is located at (0, 0, 0).
-_f_a_r___v_a_l specifies the location of the far clipping plane.
Both _n_e_a_r___v_a_l and _f_a_r___v_a_l must be positive.
Use ggllPPuusshhMMaattrriixx and ggllPPooppMMaattrriixx to save and restore
the current matrix stack.
NOTES
Depth buffer precision is affected by the values specified for
_n_e_a_r___v_a_l and _f_a_r___v_a_l.
The greater the ratio of _f_a_r___v_a_l to _n_e_a_r___v_a_l is,
the less effective the depth buffer will be at distinguishing between
surfaces that are near each other.
If
$r ~=~ "far_val" over "near_val"$
roughly $log sub 2 (r)$ bits of depth buffer precision are lost.
Because $r$ approaches infinity as _n_e_a_r___v_a_l approaches 0,
_n_e_a_r___v_a_l must never be set to 0.
ERRORS
GGLL__IINNVVAALLIIDD__VVAALLUUEE is generated if _n_e_a_r___v_a_l or _f_a_r___v_a_l is not
positive, or if _l_e_f_t = _r_i_g_h_t, or _b_o_t_t_o_m = _t_o_p.
GGLL__IINNVVAALLIIDD__OOPPEERRAATTIIOONN is generated if ggllFFrruussttuumm
is executed between the execution of ggllBBeeggiinn
and the corresponding execution of ggllEEnndd.
ASSOCIATED GETS
ggllGGeett with argument GGLL__MMAATTRRIIXX__MMOODDEE
ggllGGeett with argument GGLL__MMOODDEELLVVIIEEWW__MMAATTRRIIXX
ggllGGeett with argument GGLL__PPRROOJJEECCTTIIOONN__MMAATTRRIIXX
ggllGGeett with argument GGLL__TTEEXXTTUURREE__MMAATTRRIIXX
ggllGGeett with argument GGLL__CCOOLLOORR__MMAATTRRIIXX
SEE ALSO
ggllOOrrtthhoo((33GG)),
ggllMMaattrriixxMMooddee((33GG)),
ggllMMuullttMMaattrriixx((33GG)),
ggllPPuusshhMMaattrriixx((33GG)),
ggllVViieewwppoorrtt((33GG))