Blend not working properly

In my code to load a bitmap i have a special case that if the color is pure green, the alpha needs to be set to 0 (so that the green part of the bitmap can be seen through). I have this working in another program using drawPixels, but now when i try it in my newer program using textures, it doesn’t seem to work. I tried to use

	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
	glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );

like many tutorials said and like i had used previously but it doesn’t work. Instead, the green part of the texture shows up white. Why is this? I want the green part to be see through. I also tried many other combinations with no avail… please help

i got it to work, but i had to use a mask. i did this:

draw mask

	glBlendFunc( GL_ONE_MINUS_DST_COLOR, GL_ZERO );
	glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
draw image

but the image still had to have it’s alpha values set to 0 if i wanted them transparent. Isn’t there any way around this? I’d rather not use a mask if i can. Using both a mask and modifying the alpha values of the image seems redundant. can i do it in one step?

You should really use an alpha channel.

You can do some preprocessing on your image as you load it:

 
for(x = 0 to Image width)
for(y = 0 to Image height)
  if(Image[x][y] == green)
    Image[x][y].alpha = 0;
 

You’ll have to upload your texture as a GL_RGBA and ensure that you have blending enabled (glEnable(GL_BLEND)).

yeah i had that before but i needed the mask as well