Multitexturing can be used to combine several different texture effects on a single object. But, current hardware is limited to only 2 or 4 simultaneous textures.
As with lighting, we can exceed this limit using multiple rendering passes.
| + |
| + |
|
| = |
|
In this case, we use a constant-alpha setting with blending, to control how much the second texture is blended with the first:
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
glBlendColor(1, 1, 1, 0.2);
For the third texture, a lightmap, we use the GL_SRC_COLOR blending option to multiply the color information already in the frame buffer by the lightmap results:
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
Example: multitex.cpp