How can I define Fog in OpenGL only at a special place. With GL_FOG_START and GL_FOG_END i can only define the distance of the current user but how can i define just a small part of my world with fog?? For example when I want to simulate haze in the lower level of my world.
Peter, volume fog can be as easy or complex as you want. It all depends on what your volume looks like. One easy volume would be for example if you have a single infinite plane just above the ground and you want fog to be below that plane. In essence, creating a layer of fog over the ground.
What you then do, is for each vertex you trace a line from the camera to the vertex and check whether it crosses the fog plane. If it does, you need to know how much distance it travelled through the fog. That is, the distance from the vertex to the point of intersection with the plane.
If we call this distance the FogValue, then the final color of the vertex will be: FinalColor = OldColor * (1-FogValue) + FogColor * FogValue (Note though that you can't directly use the calculated distance as the fogvalue, you need to scale it a bit, otherwise you have too little/too much fog.)