fog trouble

Hi.

I’m trying to add fog to a project but I’m running in to a problem: I get fog, but not only away from the viewpoint but also towards it - so objects close to the ‘camera’ also has fog applied.

left image is without fog. the top of the triangle is far away, the bottom close. I’d expect the top to look as it does, but the bottom to be black like the image on the left.

I’m not setting up cameras or other funky stuff do I need to?

  
//fog  
GLfloat fogColor[4] = {1,1,1, 1.0};  
glFogi(GL_FOG_MODE, GL_LINEAR);  
glFogfv(GL_FOG_COLOR, fogColor);  
glFogf(GL_FOG_DENSITY, 1);  
glHint(GL_FOG_HINT, GL_DONT_CARE);  
glFogf(GL_FOG_START, 0);  
glFogf(GL_FOG_END, 200);  
glEnable(GL_FOG);  
  
glLoadIdentity();	  
  
glTranslatef(WIDTH*0.5f,HEIGHT*0.5f,0);  
glRotatef(90,1,0,0);  
  
//poly  
glBegin(GL_TRIANGLES);  
glColor3f(0.0f,0.0f,0.0f);			  
glVertex3f( 0.0f, 200.0f, 200.0f);		  
glVertex3f(-200.0f,-200.0f, 0.0f);		  
glVertex3f( 200.0f,-200.0f, 0.0f);  
glEnd();  

What am I doing wrong?
thanks - Patrik

What happens if you say:

glFogf(GL_FOG_END, -200);

That gives same result as without fog (all black triangle). If I also do

  
glFogf(GL_FOG_START, 200);  

then I get something like the reverse of my initial tests - no fog far and near the viewpoint, but fog at the center of the polygon (z=0)

hm…