Mesa DRI Fog Distorted

I just ported some apps to linux but every Mesa DRI driver I try breaks up the fog.

This problem occurs across every distro, graphic card, and fog mode.

It also happens with every Mesa DRI driver dated the last five years, but the ATI and NVIDIA proprietary linux drivers display the fog fine.

The following is the smallest example is could make. Its supposed to look like a long red carpet, but instead it looks like a bloody sidewalk:

GLfloat fogColor[] = {0.5,0.5,0.5,1.0}; // Grey
glEnable(GL_FOG);

/* Linear mode:
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_START, 1024.0);
glFogf(GL_FOG_END, 4096.0);
*/

/* EXP2 mode: */
glFogi(GL_FOG_MODE,GL_EXP2);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_DENSITY,0.0005f);

glHint(GL_FOG_HINT, GL_NICEST);

glBegin(GL_QUADS);
glColor3f(1,0,0); // Red
glVertex3f(-512, -512, -1024);
glVertex3f( 512, -512, -1024);
glVertex3f( 512, -512, -2048);
glVertex3f(-512, -512, -2048);
glEnd();

glBegin(GL_QUADS);
glColor3f(1,0,0); // Red
glVertex3f(-512, -512, -2048);
glVertex3f( 512, -512, -2048);
glVertex3f( 512, -512, -3072);
glVertex3f(-512, -512, -3072);
glEnd();

glBegin(GL_QUADS);
glColor3f(1,0,0); // Red
glVertex3f(-512, -512, -3072);
glVertex3f( 512, -512, -3072);
glVertex3f( 512, -512, -4096);
glVertex3f(-512, -512, -4096);
glEnd();

Never mind. I got it backwards. The Mesa DRI drivers got it right, and both ATI and NVIDA got it wrong. Imagine that! glShadeModel should have been SMOOTH, not FLAT…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.