PDA

View Full Version : GL_COMBINE_EXT and RGB -> ALPHA mapping



aerofly
05-21-2003, 03:27 PM
hello,

i have a question regarding the GL_COMBINE_EXT extension.

here is what i want to achieve:

i have a rgba texture where white pixels indicate opaque and black pixels indicate transparency. i would like to map this color information to an alpha channel, so that the texture is opaque where white pixels are and is transparent where black pixels are found.

can somebody give me a hint on how to do it with the GL_COMBINE_EXT extension ?

i tried this:


glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);

glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE);

glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_PRIMARY_COLOR_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_ARB, GL_SRC_COLOR);

for some reason this doesnt work. what am i doing wrong here ?

any help is appreciated!

vincoof
05-22-2003, 02:45 AM
Please don't cross-post unless you did not get a reply after a long time.
Go check the topic in the advanced forum which is currently active.