Slide 4
Slide 4 text
Javier Gonzalez-Sanchez | SER431 | Fall 2018 | 3
jgs
Add this Code to your init() method
glEnable(GL_FOG);
// specifies the equation to be used to compute the fog blend factor.
// GL_LINEAR, GL_EXP, and GL_EXP2.
// initial fog mode is GL_EXP
glFogi(GL_FOG_MODE, GL_LINEAR);
// the fog color. Color components are in the range [0,1].
// the initial fog color is (0, 0, 0, 0).
GLfloat fogColor[4] = { 0.5, 0.5, 0.5, 1.0 };
glFogfv(GL_FOG_COLOR, fogColor);
//Used in exponential fog equations. The initial fog density is 1.
// Only nonnegative densities are accepted.
glFogf(GL_FOG_DENSITY, 0.25);
// the near distance used in the linear fog equation. The initial near distance is 0
glFogf(GL_FOG_START, 10.0);
// the far distance used in the linear fog equation. The initial far distance is 1.
glFogf(GL_FOG_END, 6000.0);