Which BlendFunc(...) to use ?

Please help me choose the proper blending function:

I have an RGB image with some BLACK spots…

How do I make those BLACK areas transparent ?

Thanks.

If I were you, I would try to make your RGB image an RGBA image and set the alpha value whenever there’s a black spot to zero (and to one otherwise).

Then I would:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4d(1,1,1,1);

…before I started putting the vertexes out.

// David

I’m using glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
textures: I bind 24 and 8 bit bitmaps or make alpha from choosen color and create file that can be directly load to memory.

If you want I can send source or .exe of my binder - it’s made in bc++b.

To make the black spots transparent you’d have to use something like:

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);

That will probably not look very satisfying though. The better way is to add an alpha channel because that gives you independent control of color and alpha, and then use the other suggestions already posted.

Thanks a lot.

I’m getting Ok results with this:

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);
// select the cactus texture
glBindTexture(GL_TEXTURE_2D, tex_id);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glBegin(GL_TRIANGLE_STRIP);


glEnd();

glDisable(GL_ALPHA);
glDisable(GL_BLEND);

Image is basically a tree with BLACK background.
Sometimes, I can still see “black” dots here and there near the corners…( during rendering )

Whats the reason for that ?
Could someone tell me how to create an ALPHA map in photoshop ?

Thanks.