PDA

View Full Version : texture use



aQ
04-29-2005, 07:27 PM
float a[]={0.1,0.5,0.9,0.4);
glTexEnvfv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_COLOR,a);

glTexEnvI(GL_TEXTURE_ENV,GL_TEXTURE_MODE,BLEND);

glColor4f(0.9,0.5,0.1,0.8);

how these two color affact the ultimate apperance

dorbie
05-02-2005, 12:21 PM
I've included the table from the man page on texblend. It depends on the texture format but basically it uses the texture color as a blend between the interpolated polygon color and the constant texture environment color.

In your example the texture image will act as a weight to blend between the two colors:

float a[]={0.1,0.5,0.9,0.4);

glColor4f(0.9,0.5,0.1,0.8);

The results will depend on the image format in the texture, if it's a luminance image you'll only see images on a linear scale between teh two colors, but a color format will independently interpolate components.

From the table you can see that 0.0 in the texture gives all polygon color and 1.0 gives all texture environment color.


+---------------+---------------+
| Base Internal | GL_BLEND |
| Format | |
+---------------+---------------+
| GL_ALPHA |C=Cf |
| |A=AfAt |
+---------------+---------------+
| GL_LUMINANCE |C=Cf(1-Lt) + |
| |CcLt |
| |A=Af |
+---------------+---------------+
| GL_LUMINANCE_ |C=Cf(1-Lt) + |
| ALPHA |CcLt |
| |A=AfAt |
+---------------+---------------+
| GL_INTENSITY |C=Cf(1-It) + |
| |CcIt |
| |A=Af(1-It) + |
| |AcIt |
+---------------+---------------+
| GL_RGB |C=Cf(1-Ct) + |
| |CcCt |
| |A=Af |
+---------------+---------------+
| GL_RGBA |C=Cf(1-Ct) + |
| |CcCt |
| |A=AfAt |
+---------------+---------------+