PDA

View Full Version : gl_FogCoord



Groovounet
12-05-2005, 05:36 AM
I would like to check the use of gl_FogCoord.

When I would like to render a volumic fog I use in my C/C++ code the function "glFogCoordPointer".

Then in the vertex shader I get the value with
gl_FogFragCoord = gl_FogCoord;

And It works well on my GF6600.

But when I use view fog, I toggle
"glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE)"
to
"glFogi(GL_FOG_COORDINATE_SOURCE, GL_FRAGMENT_DEPTH)"

and gl_FogCoord look null I have to use this:
"vec4 Position = gl_ModelViewMatrix * gl_Vertex;"
"gl_FogFragCoord = abs(Position.z);"

Should the value of gl_FogCoord be the same than the abs(v_Position.z) one?