gl_fog

Hi…
I’m using GL_FOG in an 3d terrain engine, but it seem only to work in the Z axis…
That is, I have the desired fog effect in the Z axis, but when the camera rotates to the X axis, the fog effect gradually decrement…, then when I turn the camera to the Z axis, it works again
what happens? Any idea to solve it?

Thanks!!

A wild guess. Are you doing your rotation in the projection matrix? If so, shame on you, you should do it in the modelview matrix.

no,
now I’m using glLookAt()…

gluLookAt multiplies the CURRENT matrix with another one… Which matrix is current when you call it ???

Is it the PROJECTION_MATRIX or the MODELVIEW_MATRIX ???

If first case, then switch to the second !

Regards.

Eric

What is the terrain ?

Very large polygons ?

Some cards do not do per-pixel fog and only interpolate through the fog applied at each vertex. Rotating through 90 degrees could be badly affecting how this works.