![]() |
|Download Files|
![]() ![]() ![]() ![]() ![]() Next: 3.10 Antialiasing Application Up: 3 Rasterization Previous: 3.8.6 Texture Application
3.9 FogIf enabled, fog blends a fog color with a rasterized fragment's post-texturing color using a blending factor f. Fog is enabled and disabled with the Enable and Disable commands using the symbolic constant FOG. This factor f is computed according to one of three equations:
(z is the eye-coordinate
distance from the eye,
void Fog[if] ( enum pname, T param ) ; If pname is FOG_MODE, then param must be, or params must point to an integer that is one of the symbolic constants EXP, EXP2, or LINEAR, in which case equation 3.16, 3.17, or 3.18, respectively, is selected for the fog calculation (if, when 3.18 is selected, e = s, results are undefined). If pname is FOG_DENSITY, FOG_START, or FOG_END, then param is or params points to a value that is d, s, or e, respectively. If d is specified less than zero, the error INVALID_VALUE results.
An implementation may choose to approximate the eye-coordinate distance
from the eye to each fragment center by
No matter which equation and approximation is used to compute f,
the result is clamped to
f is used differently depending on whether the GL is in RGBA
or color index mode.
In RGBA mode,
if
(The rasterized fragment's A value is not changed by fog blending.)
The R, G, B, and A values of In color index mode, the formula for fog blending is
where
The state required for fog consists of a three valued integer to select the
fog equation,
three floating-point values d, e, and s,
an RGBA fog color and a fog color index,
and a single bit to indicate whether or not fog is enabled.
In the initial state,
fog is disabled,
FOG_MODE is EXP,
![]() ![]() ![]() ![]() ![]() Next: 3.10 Antialiasing Application Up: 3 Rasterization Previous: 3.8.6 Texture Application David Blythe Sat Mar 29 02:23:21 PST 1997
|