Here is a tutorial that shows how to implement fog in OpenGL Shading Language. Fog equations are explained and per-vertex and per-pixel fog GLSL shaders are detailed. Several simple demos using
Demoniak3D are provided to illustrate all concepts.

LINK:
http://www.ozone3d.net/tutorials/glsl_fog/