params contains four integer or floating-point values that specify
$C sub f$, the fog color.
Integer values are mapped linearly such that the most positive representable
value maps to 1.0,
and the most negative representable value maps to -1.0.
Floating-point values are mapped directly.
After conversion,
all color components are clamped to the range [0,1].
The initial fog color is (0, 0, 0, 0).
Fog blends a fog color with each rasterized pixel fragment's posttexturing
color using a blending factor $f$.
Factor $f$ is computed in one of three ways,
depending on the fog mode.
Let $z$ be the distance in eye coordinates from the origin to the fragment
being fogged.
The equation for GL_LINEAR fog is
f ~=~ {end ~-~ z} over {end ~-~ start}
The equation for GL_EXP fog is
f ~=~ e sup {-^(density ~cdot~ z)}
The equation for GL_EXP2 fog is
f ~=~ e sup {-^(density ~cdot~ z)} sup 2
Regardless of the fog mode,
$f$ is clamped to the range [0, 1] after it is computed.
Then,
if the GL is in RGBA color mode,
the fragment's red, green, and blue colors, represented by $C sub r$,
are replaced by
{C sub r} sup prime ~=~ f^C sub r ~+~ (1 - f)^C sub f
Fog does not affect a fragment's alpha component.
In color index mode, the fragment's color index $i sub r$ is replaced by
{i sub r} sup prime ~=~ i sub r ~+~ (1 - f)^i sub f