problems with blending....

I am trying to draw a textured rectangle, using two triangles. I want the black pixels in my texture to be transparent and everything else to be visible.

I have used some code I found on this forum, but the resultant texture still shows black
as solid.

basically I read the raw rgb data, look for
rgb triplets with value 0,0,0 and copy
the same rgb values into an rgba data block
replacing the alpha component with 0 for black and 1 for anything else.

I then call gluRGBuild2dmipmaps specifying rgba valued data.

Finally, I draw the texture using:

glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

and the black pixels come out as solid.

I can email the code to anyone who can assist.

dd

Have you done
glEnable(GL_BLEND);

Also, the alpha component should be 255 for opaque, not 1

If you really want only the black part to be blended just use

glBlendFunc(GL_SRC_COLOR,GL_ONE);

and everything that tents to black will be blended.
That’s not the best way of doing blending, but it works and you gain memory space trashing the alpha values.

rIO http://www.spinningkids.org/umine

mail me the code ill take a quick look

sexybastard@clear.net.nz

Oops…typing error…

yes glEnable ( GL_BLEND ) is in there before
texturing…I am getting transparency!
I want the non black pixels to be solid though.

Also, I was setting the alpha component to 255, I just typed 1 for some reason