For our last class in Console Programming we were tasked to make something cool in groups of 2. For this Mat Brand and I grouped up to make a basic fog effect in OpenGL. OpenGL contains a glFog function, to start you call glEnable(GL_FOG).
There are four basic parameters you will need to set after fog is enabled. The first being the fog color, this is what color the pixels will be when completely covered by fog. This can be done with glFogfv(GL_FOG_COLOR, FogColor), with FogColor being a float[3]. The next is the fog mode, this determines how the color of the pixel is blended with the color of the fog based on distance. to do this use glFogi(GL_FOG_MODE, GL_LINEAR), GL_EXP, and GL_EXP2 can also be used. And finally you need to define the start and end distance of the fog. this is done with glFogf(GL_FOG_START, startDistance), and glFogf(GL_FOG_END, endDistance).
No comments:
Post a Comment