PDA

View Full Version : Texture Environment Modes



Fugit
08-31-2000, 07:54 AM
Hi,
Just a quick question - what's the difference between GL_DECAL, GL_MODULATE, and the other texture environment mode? What do they do?

thx

MikeM
08-31-2000, 09:54 AM
They specify how a texture will appear when it is rendered on a poly.

For instance, in GL_DECAL, the original color of the poly is ignored and the texture is slapped on the poly as if it were a sticker (or a decal!). In GL_MODULATE and GL_BLEND, the color of the underlying polygon is merged with the color of the texture. The difference between the two is explained in the Red Book, but I would recommend you perform a test of your own to get an idea of what each does.

When I use GL_MODULATE, the texture is 'tinted' with the color of the underlying poly. I haven't used GL_BLEND much, but from what I remember, it caused the texture to be darkened. This would make sense if the poly color and the texture color are averaged in GL_MODULATE and added together in GL_BLEND.

Gorg
08-31-2000, 09:55 AM
just look in the red book. You can get it online. Just looks on nehe's page.

I don't remeber what gl_decal does, but

GL_MODULATE multiplies the color of the fragment(f) with the incoming texture(t) pixel.

Cpoly = (Rf*Rt, Gf*Gt, Bf*Bt)

The most obvious example of that is a lightmap.

You first apply a color or a texture to your polygon and then you modulate the lightmap with the present color giving the effect of light. So if you your lightmap is 0, the color of the polygon will be zero.

GL_REPLACE simply does

Cpoly = Ct