Fog problem

Hi! I’ve got some proglem with fog in opengl…

First I set the projection matrix like this:
glOrtho(0.0f, (GLfloat)width, 0.0f, (GLfloat)height, 0.0f, 1.0f);

Then I enable fog and set parameters:
GLfloat color[4] = { r/255, g/255, b/255, 1.0f };

glFogf(GL_FOG_START, S);
glFogf(GL_FOG_END, E);
glFogf(GL_FOG_DENSITY, 0.35f);
glFogfv(GL_FOG_COLOR, color);
glClearColor(r, g, b, 1.0f);

And finally I put some triangles on the screen like this:
zRecip = 1.0f / pPnt->z;
glVertex3f(pPnt->x, pPnt->y, -1.0f + zRecip);

The problem is that fog isn’t working well. How should I set START and END to have it work? When I set START to 0.5, END to 0.75 no fog is displayed. If I set START to 1, END to 5 there is fog, but it is - how should I say - static. I mean everything is covered with the same amount of fog no matter how far the vertex is from the camera position.

Is there anyone how could help me?

Sorry I can’t tell you the exact solution, but there are 3 different types of fog, (I don’t know their names, that’s the problem) which need a different amount of processor power. Go to nehe’s site ( have a look at the fog tutorial ( number 10 or something like that)
Hope this helps.

density doesnt work for linear fog.
start is where the fog starts at in depth values ie up unitil this point fog is 0 and from this point until end it gradually gets thicker.

use this
distance = lengthofvector( verice - camera )
distance will now contain (in units) how far the vertice is away from the camera.
this should give u an idea on what values to use for the start + end numbers of the fog equation

I’ve already tried what’s on Nehe’s page, but it didn’t work.

I also tried FOG_EXP, EXP2, but also they didn’t work. I donwloaded a sample program, and it worked well. I’ve set every parameter to what was in the sample, but nothing happened. So I thought it is because I use a different projection matrix.
I don’t know what to do…