I can’t seem to find any documentation on what each of the GL_OPERANDn/GL_SOURCEn types stand for in the blending equation.
Does anyone have a link (or is kind enough to post here) what each definition represents (forumula wise and parameter wise, ie: what’s the difference between an operand and a source and how do they tie into the blending equation)?
I’ve been trying to assign one texture’s alpha to another texture (or using one grayscale texture as another’s alpha) but I haven’t had any success as I can’t figure out what each glTexEnvi parameter stands for!
The best place, as always, is the OpenGL spec. See section 3.8.13 which should answer all your questions.
Thanks that helps lots! Definitely saving that file…
I now understand what I’m doing, but the results are still not what they should be.
Here’s the code:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_ALPHA);
Basically that should take the rgb of the first and the alpha of the second, yet the result is odd…it’s as if the whole texture had a 0.5 alpha value (I know the texture is good as I’ve set it up to render the alpha map without multi texturing and it worked fine).
Any idea as to why?