glFog

OpenGL fog mixes the color of a polygon with the color of the fog. The degree of mixing is a function of the distance from the camera to the polygon.

finalColor = f * polyColor + (1-f) * fogColor

Example:

    glEnable(GL_FOG)
    glFogi(GL_FOG_MODE, GL_LINEAR)
    glFogfv(GL_FOG_COLOR, [1, 1, 1, 1])
    glFogf(GL_FOG_START, 5.0)
    glFogf(GL_FOG_END, 40.0)