PDA

View Full Version : Transparency question



Ace_Man
11-02-2000, 04:17 PM
If I have a black texture with a white circle in the middle of it. How can I set transprency to to make the black around the circle disapear?

Michael Steinberg
11-02-2000, 04:57 PM
Make it an RGBA texture. RGB represents the circle color, for your purpose it's white.
The Alpha values should be one for untransparent (visible) and zero for completely transparent. Set it up to GL_MODULATE.
Then before drawing the texured face (which will end up in a white circle, or whatever color you chose for the poly or the texture)

glBindTexture(GL_TEXTURE_2D,gl_circle_name );
glTexEnvi(
GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_DST_ALPHA );

Then draw the textured quad.

Ace_Man
11-02-2000, 05:34 PM
Thank you..

It got rid of the black but the circle is transparent. I don't want to see through the circle...Is it possible to fix this?

Thank you again

Ace_Man
11-02-2000, 05:39 PM
I also would like to apply it to other bitmaps...like say a black outlined jet mapped to a quad...by erasing the black..all I see is the jet

niko
11-02-2000, 08:09 PM
Try with glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). See also what happens with glBlendFunc(GL_ONE, GL_SRC_ALPHA)..

/n