next up previous
Next: Texture Mapping: Up: OpenGL Quick Reference Guide Previous: Lighting:

Blending and Fog

Blending and fog are two OpenGL capabilities that allow you to produce interesting lighting and coloring affects. When a pixel is to be drawn on the screen, it normally overwrites any existing pixel color. When blending is enabled (by calling glEnable(GL_BLEND)) then the new (source) pixel is blended with the existing (destination) pixel in the frame buffer.

glBlendFunc(GLenum sfactor, GLenum dfactor):
Determines how new pixel values are blended with existing values. The arguments indicate what factors are multiplied by the source and destination RGBA values, respectively, before they are added together. See the reference manuals for complete information.

Fog produces an effect whereby more distant objects are blended increasingly with a fog color, typically some shade of gray. It is enabled by calling glEnable(GL_FOG).
glFogf(GLenum pname, GLfloat param):
Specifies the parameters that define how fog is computed. The first version is for defining scalar parameters, and the second is for vector parameters. See the reference manual for complete details.

Please report any errors or send comments to Dave Mount

Last updated: Sat, Feb 8, 2003.