PDA

View Full Version : no fog in smooth shading



Zerosignull
05-19-2000, 01:21 AM
how do i get opengl to do fog when im in smooth shading mode????

ok here th bit of fog code from my prog

glEnable(GL_FOG); //fog settings
{
GLfloat fogColor[4] = {0.0, 0.0, 0.7, 0.5};
glFogi (GL_FOG_MODE,GL_LINEAR);
glFogfv (GL_FOG_COLOR, fogColor);
glFogf (GL_FOG_DENSITY, 0.1);
glFogf (GL_FOG_START, 1);
glFogf (GL_FOG_END, 10);
glHint (GL_FOG_HINT, GL_FASTEST);
}
glClearColor(0.0, 0.0, 0.7, 1.0);

[This message has been edited by Zerosignull (edited 05-20-2000).]

Kaeto
05-19-2000, 05:53 PM
Could you explain the problem in more detail?

Eric Chan
05-19-2000, 06:51 PM
Check that blending is on.

glEnable(GL_BLEND);

Did you specify the fog mode?

e.g. glFog(GL_FOG_MODE, GL_EXP2);

ec

Serge K
05-20-2000, 06:48 PM
to Eric Chan:

Check that blending is on.
Don't need it.
The fog is independent from blending.

Did you specify the fog mode?
Look at this line: http://www.opengl.org/discussion_boards/ubb/rolleyes.gif
> glFogi (GL_FOG_MODE,GL_LINEAR);

to Zerosignull:

Make sure that you geometry lies in the fog range. (GL_FOG_START..GL_FOG_END)

btw, if you want linear fog, you don't need to set GL_FOG_DENSITY.
This parameter is used for exponential fog only.