PDA

View Full Version : Fog questions...



c_olin
08-03-2003, 11:45 AM
I've ben playing around with fog, but it hasn't been working like i want it too... here's the code so far:



GLuint fogMode[]= { GL_EXP, GL_EXP2, GL_LINEAR };
GLfloat fogColor[4]= {0.32f, 0.5f, 1.0f, 1.0f};

glFogi(GL_FOG_MODE, fogMode[0]);
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_DENSITY, 0.7f);
glHint(GL_FOG_HINT, GL_DONT_CARE);
glFogf(GL_FOG_START, 500.0f);
glFogf(GL_FOG_END, 1000.0f);
glEnable(GL_FOG);


I want the fog to start way off in the distance, but however i set Gl_START and GL_END it is sitll the same, please help!

hkyProgrammer88
08-03-2003, 03:16 PM
Try using negative numbers. I am just guessing here since I never worked with fog.

glFogf(GL_FOG_START, -500.0f);
glFogf(GL_FOG_END, -1000.0f);

Jan
08-04-2003, 02:09 AM
Im not sure, but i think the START and END parameters only work for linear fog, not for exponential.

Jan.

errno
08-04-2003, 03:09 AM
yes, GL_FOG_START and GL_FOG_END are the linear fog's paramaters.
GL_FOG_DENSITY is the GL_EXP and GL_EXP2 parameter.

john
08-04-2003, 04:30 AM
also, the start/end parameters are in the range 0-1; 0 is the near plane and 1 is the far plane.

Jared@ETC
08-04-2003, 06:56 AM
Huh?

GL_FOG_START and GL_FOG_END are straight z values...they aren't normalized to 0->1.

john
08-05-2003, 12:08 AM
are they?
hmm
my bad. :-/
I thought they were taken from the projection matrix. but maybe I am just confused