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:


and the black pixels come out as solid.

I can email the code to anyone who can assist.


Have you done

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

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


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.


mail me the code ill take a quick look

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