Johnson.N.M.B
08-06-2006, 08:37 PM
Here is a piece of code:
// Set red fog some where
GLfloat red[4] = {1,0,0,0};
glFogfv (GL_FOG_COLOR, red);
...
// Here set black fog
GLfloat black[4] = {0,0,0,0};
glFogfv (GL_FOG_COLOR, black);
glDrawElements(... ...);
This produces black fogged scene, as we expected.
now, I change the code to:
// Set red fog some where
GLfloat red[4] = {1,0,0,0};
glFogfv (GL_FOG_COLOR, red);
...
// Here set black fog
glPushAttrib (GL_FOG_BIT); // Added
GLfloat black[4] = {0,0,0,0};
glFogfv (GL_FOG_COLOR, black);
glDrawElements(... ...);
glPopAttrib (GL_FOG_BIT); // Added
Now the scene is rendered with red fog! Why? It's quite strange, and it happens with both ATI X700 and NVidia FX5200.
// Set red fog some where
GLfloat red[4] = {1,0,0,0};
glFogfv (GL_FOG_COLOR, red);
...
// Here set black fog
GLfloat black[4] = {0,0,0,0};
glFogfv (GL_FOG_COLOR, black);
glDrawElements(... ...);
This produces black fogged scene, as we expected.
now, I change the code to:
// Set red fog some where
GLfloat red[4] = {1,0,0,0};
glFogfv (GL_FOG_COLOR, red);
...
// Here set black fog
glPushAttrib (GL_FOG_BIT); // Added
GLfloat black[4] = {0,0,0,0};
glFogfv (GL_FOG_COLOR, black);
glDrawElements(... ...);
glPopAttrib (GL_FOG_BIT); // Added
Now the scene is rendered with red fog! Why? It's quite strange, and it happens with both ATI X700 and NVidia FX5200.