94
Chapter 8: Lighting and Fog
All types of geometric primitives can be fogged, including points and lines. Using the fog
effect on points and lines is also called depth-cuing and is popular in molecular modeling
and other applications.
How to Use Fog in Cosmo 3D Applications
Fog is generated by setting up a csFog node and adding it to the csEnvironment. The
csFog class has the following fields, which determine its effects:
The effects of the different fields are parallel to those of OpenGL glFog(), and can be
examined in the OpenGL Reference Manual or the glFog manpage.
Enabling Fog
There are three different fields that determine whether fog is enabled or not:
• csContext::fogEnable
• csAppearance::fogEnable
• csFog::on
Table 8-1 Fields in csFog
Type Name Enumerant Default
csSFBool on ON false
csSFEnum mode MODE FOG_EXP
csSFFloat density FOG_DENSITY 1.0
csSFFloat start FOG_START 0.0
csSFFloat end FOG_END 1.0
csSFFloat index FOG_INDEX 0.0
csSFVec4f color FOG_COLOR {0.0, 0.0, 0.0, 0.0}