cut off background of image

I’m making a menu and i want that it will be transporent, but i have a problem:
i use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) - it make it transporent,
but i see the background of image?

Can you explane me how to cut off background of image(bmp or tga)?
(with out glBlendFunc(GL_SRC_ALPHA, GL_ONE) or which make the same effect.)

If you want to make it transparent in some places only you have to use alpha test.
Look fo glEnable(GL_ALPHA_TEST) in your preferred OpenGL help system or search on these forums.

sorry but “glAlphaFunc” it doesn’t work
I think that you didn’t understand me. I try to explane

i have a bmp file with picture



    • background(which black or other color)
      0 - other picsels(picture)

I want to don’t see “*” on texture(it will be fully transparent)
and “0” will be transporent for 70%.

You have to specify an alpha channel for the alpha test to work.

To do this, when you load your texture as a RGB 24bpp bitmap, copy it to a buffer which has a RGBA 32 bpp depth. Copy RGB to RGB and for A put 0 if R=G=B=0 (black) and 1 otherwise. Then create a RGBA texture.
Then specify a value of say 0.5 for the alphatest’s trigger value and draw your textured geometry with alphatest enabled.

If you want to make the rest of the texture 70% transparent, do as above but when the pixel’s color is not black, put 0.3 for the A component instead of 1.
Then use blending instead of the alphatest (Probably the best blend function for that is glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)).

Alternatively, you can use a targa bitmap which already has the alpha channel and load it as the RGBA texture.

Can you sent me a simple code with tga load and fully transporent background?

I’ll try to find something in some of my old code tomorrow.
Now I’m going to sleep, it’s 0.30 here

Thank you!!!
If you find it sent to