PDA

View Full Version : GL_EXT_fog_coord problem



Tom Speed
12-10-2005, 10:17 AM
Hi all,

I'm experimenting with GL_EXT_fog_coord with a view to creating a ground based fog (fog vertex = vertex Y height) on a 'per entity/mesh' basis, but I'm getting some odd behaviour and I don't know why.

In this picture (http://www.tomspeed.com/fogproblem.jpg) I have 3 screenshots of 3 meshes. Each scene renders the 3 meshes with a different order of fog setting. The code I use is shown at the top.

For some reason if I render coordinate based fog directly after depth based fog, the coordinate fog is rendered using depth based fog instead.

The middle mesh in the bottom pic is the incorrect one.

Additionaly here's another picture (http://www.tomspeed.com/fogproblem2.jpg) that seems to contradict what I just said (it DOES render coord based after depth based), but then I get some odd highlights.

Any idea as to what I'm doing wrong?
Am I missing some code to ensure the fog mode is depth based?

I can confirm that I'm getting no glErrors at all within Select/End Select, and no glErrors when rendering.

Thanks!
Tom

Tom Speed
12-10-2005, 07:55 PM
Ok I figured it out.

GL_FOG_HINT .. when using GL_NICEST that forces per-pixel fog, using GL_FASTEST along with coordinate fog works fine.