View Full Version : glFog and OpenGL version >= 3.1

09-13-2011, 04:20 AM
I have just a question about fog generation. It is completely depricated. How I do it? With shaders? When yes, can somebody give me a reference example or even a link?
Or there are other techniques to do it?

Alfonse Reinheart
09-13-2011, 04:27 AM
The kind of fog computed by the fixed-function pipeline is just a cross-fade, based on depth (or some other positional value), between the color produced by lighting and the fog color. The OpenGL specification explains the math behind the various fog computations.

09-13-2011, 05:34 AM
So, I have to compute the color of each vertex in the shader?

Alfonse Reinheart
09-13-2011, 02:02 PM
Where you do it is up to you. Personally, I would use per-fragment fog, but if you want to exactly emulate the fixed-function fog, you compute the fog interpolation parameter in the vertex shader and do the cross-fade in the fragment shader.

09-13-2011, 02:13 PM
Thanks a lot!

09-13-2011, 02:17 PM
But here I have the next question...
glTexCoord*(..) is depricated as all the other fixed functions like glVertex*(..).
How I have to handle the texture coordinates? Like the vertex coordinates and binded in vertexarray/buffer object?