additive texture combiner
Posted
by ivicaa
on Stack Overflow
See other posts from Stack Overflow
or by ivicaa
Published on 2010-05-31T10:35:53Z
Indexed on
2010/05/31
10:43 UTC
Read the original article
Hit count: 242
I have a problem which is driving me crazy.
Enironment: IPHONE, OpenGL ES 1.1
Basically I have a simple GL_COMBINE for vertex color and texture color.
glColor4f(0.1f, 0.1f, 0.1f, 0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
It should simply do VertexColorRGBA + TextureRGBA. With Alpha everything works fine, but if as soon as I change R,G,B in the glColor4f call, the final alpha is also modified. Does anyone have a hint for this unexpected behavior?
Thanks in advance! Ivica
© Stack Overflow or respective owner