Draw bitmap with transparent portions

I am trying to draw a bitmap with certain portions/pixels that will be transparent. Right now I am using glut and creating a texture with RGBA color type. For the portions of the bitmap that I want transparent I set A=0, and A=255 for the rest.

I cant quite figure out if it is just proper glBlendFunc parameters that I need… or if I am doing this all wrong?

If I do

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

then the portions of the bitmap that I want transparent are indeed transparent, but then they are just whatever the color that was las set by glColor4f(…), and not the colors of the background

All of the tutorials I see online teach how to set the transparency for the whole texture/bitmap. I just want to be able to set for specific pixels somehow.

Any leads? Thanks in advance

Ah nevermind, I figured it out :slight_smile:

Just incase anyone runs into same situation, here is what I was doing wrong:

glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );

I had this set for my textures. When I removed it it worked properly if I used

	glEnable( GL_ALPHA_TEST );
	glAlphaFunc( GL_GREATER, 0.1f );

(and make sure to disable alpha test after drawing texture).