Fog in OpenGL
|
Prof. David Bernstein |
Computer Science Department |
bernstdh@jmu.edu |
void glFog*v(GLenum pname, TYPE *params)
pname
is GL_FOG_COLOR
and params
points to the RGBA valuesvoid glFog*(GLenum pname, TYPE params)
pname
is GL_FOG_MODE
and TYPE
is either GL_EXP
,
GL_EXP2
, or GL_LINEAR
pname
can be GL_FOG_DENSITY
,
GL_FOG_START
, or GL_FOG_END
glEnable(GL_FOG);
/** * Display/render the OpenGL window */ void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glTranslatef(-1.0, -0.5, -2.0); glutSolidTeapot(0.5f); glPopMatrix(); glPushMatrix(); glTranslatef(0.0, -0.5, -3.5); glutSolidTeapot(0.5f); glPopMatrix(); glPushMatrix(); glTranslatef(1.0, -0.5, -5.0); glutSolidTeapot(0.5f); glPopMatrix(); glFlush(); }