glFog and OpenGL version >= 3.1

Hello,
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?

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.

So, I have to compute the color of each vertex in the shader?

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.

Ok!
Thanks a lot!

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?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.