If you have the following combination, your white cat may turn red.
Why is that? It is because the modulate function (or mode) is set for the texture.
There are four possible functions for computing the final RGB value shown in your texture-mapped image:
To specify which mode or function you want to use to calculate your final RGB values, you would use the glTexEnv*() function. For instance, to specify that you are using Decal mode, you would use the following statement:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
To change to the other modes, you would replace GL_DECAL with GL_REPLACE, GL_MODULATE, or GL_BLEND.
The following table represents what happens (with RGB) when the kitten picture is combined with the red object using these different modes. An additional column provides the function used to calculate the final color (RGB). The color is represented by C. A subscript of t indicates a texture value, f indicates the fragment (or object) value, c indicates the value assigned with GL_TEXTURE_ENV_COLOR, and no subscript indicates the final, computed value.
Mode | Function | Resulting Image |
GL_DECAL | C=Ct | |
GL_REPLACE | C=Ct | |
GL_MODULATE | C=CfCt | |
GL_BLEND | C=Cf(1-Ct) + CcCt |