Syntax
[C/C++:]
void gDefineFog(int mode, int colour, ...);
[F90:]
subroutine gDefineFog(mode, colour, gStart, gEnd, gDensity)
integer, intent(in) :: mode,colour
real, optional, intent(in) :: gStart, gEnd, gDensity
Arguments
mode
Fog mode
|
= GLINEAR, |
Linear for depth-cueing |
|
= GEXP1, |
Exponential for cloud and heavy fog |
|
= GEXP2, |
Exponential for smoke and weather haze |
colour
Fog  colour (index or 24bit true colour value)
Optional Args
gStart
Start depth for linear fog (default = 0.0)
gEnd
End depth for linear fog (default = 3D viewport Z range)
gDensity
Fog density for exponential modes (default = 0.0025)
Description
The routine gDefineFog() specifies the current fog
mode and
colour. When switched on, in conjunction with depth buffering (see gSetShadingMode()), objects further away from the viewer are blended into the specified fog
colour according to the specified
mode.
The optional arguments
gStart and
gEnd are used for GLINEAR mode, where objects in front of
gStart are displayed normally, objects between
gStart and
gEnd are linearly blended into the fog colour and objects behind
gEnd are displayed totally in the fog colour. The default range of values for
gStart and
gEnd are 0.0 to the 3D viewport Z range which represents the eye-point to the furthest possible distance of the scene.
The GEXP1 and GEXP2 modes represent more realistic atmospheric fog modes, with the former using an exponential function of  - (
gDensity * viewing distance)  and the latter using a function of  - (
gDensity * viewing distance) squared. Values in the range 0.5 to very small give realistic effects.
See Also
gDefineFog UsagegSetShadingModegSetViewport3D