strange but nice behaviour of GL_COMBINE_ALPHA mode on a GeForce 4 Ti

Hi

while playing around with the texture environment setting GL_COMBINE I discovered something nice.

As you know there are separate calculations done for RGB and ALPHA. You set RGB function with GL_COMBINE_RGB and ALPHA function with GL_COMBINE_ALPHA.

For GL_COMBINE_RGB the valid GL_OPERANDn_RGB are GL_SRC_COLOR,GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA

For GL_COMBINE_ALPHA the valid GL_OPERANDn_ALPHA are GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA

But when I use GL_SRC_COLOR or GL_ONE_MINUS_SRC_COLOR for GL_COMBINE_ALPHA I don’t get a error!. Instead the alpha value is the greyscale version of the rgb value!!!.

Sounds interesting. Can anyone verify this on other cards? Perhaps matt?

I use a GeForce4 TI 4600 with 41.03 drivers.

Bye
ScottManDeath

I wasn’t aware of the ability to route color to RGB using ARB_texture_env_combine. It is possible in an odd NV_register_combiners mode (I think you can route blue to alpha).

Looking at our driver source, it certainly appears that trying to set GL_OPERANDn_ALPHA to GL_SRC_COLOR or GL_ONE_MINUS_SRC_COLOR should result in an error. You can check by calling glGetError(). Such calls should not change whatever state you have set. Perhaps something else makes it look like you’re getting color?

Pat

Hi

indeed, the alpha value gets assigned from the blue channel. I recognized this behaviour in 2 different programs. I tested again and when I use the primary color as source the blue channel is copied into alpha. After setting all modes I check for GL errors but no one does occur.

Bye
ScottManDeath

I’ve got a GL_LUMINANCE texture and copy the LUMINANCE to alpha. glgeterror returns 0 after the last line. Is this only a bug or the expectable behavior of this extension.

glTexEnvi(GL_TEXTURE_ENV,GL_COMBINE_ALPHA_EXT,GL_REPLACE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA_EXT,GL_TEXTURE);
glgeterror;
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_EXT,GL_SRC_COLOR);
showmessage(inttostr(glgeterror)); // shows 0

Should generate an INVALID_ENUM error for both ARB_texture_env_combine and EXT_terxture_env_combine. Check the specs (errors at the end) at : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_env_combine.txt http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_env_combine.txt

Haven’t looked at OpenGL1.3 specifications, but I guess this would generate an error too.

I fixed this bug on 10/28 (SRC_COLOR/ONE_MINUS_SRC_COLOR erroneously allowed for alpha operands). Drivers built after that date will include the fix.

  • Matt