PDA

View Full Version : strange but nice behaviour of GL_COMBINE_ALPHA mode on a GeForce 4 Ti



ScottManDeath
12-26-2002, 02:02 PM
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

pbrown
12-26-2002, 06:09 PM
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

ScottManDeath
12-26-2002, 11:36 PM
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

LarsMiddendorf
12-26-2002, 11:45 PM
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_R EPLACE);
glTexEnvi(GL_TEXTURE_ENV,GL_SOURCE0_ALPHA_EXT,GL_T EXTURE);
glgeterror;
glTexEnvi(GL_TEXTURE_ENV,GL_OPERAND0_ALPHA_EXT,GL_ SRC_COLOR);
showmessage(inttostr(glgeterror)); // shows 0

vincoof
12-27-2002, 12:34 AM
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.

mcraighead
12-28-2002, 01:58 AM
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