View Full Version : Blending and fog?

11-27-2000, 09:52 PM
I'm certain this is something silly, but I've been having problems modifying one of NeHe's tutorials to do both blending and fog at the same time (http://nehe.gamedev.net/tutorials/lesson16.asp)

The code basically displays a cube on the screen; every face of the cube has a texture mapped on it.

If I enable the fog (any kind of fog: EXP, EXP2, LINEAR) and blending on the cube's faces (say glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA)) the cube comes out all white and it seems like the fog is completely ignored (no matter how I translate the cube away/towards from the eye, no fog effect is visible--it stays white.) If I disable the blending, everything looks normal (both the texturing and the fog.)

The thing that's puzzling is that I thought fog was applied *post* texturing, and is dependent on the distance from the eye (so, the texture color should have no bearing on whether the fog effect shows or not.)

Is there something really obvious I'm missing here? I can post code if that helps debug this.

May thanks,