Advertisement

Blending bitmaps

Started by September 29, 2003 06:45 AM
2 comments, last by trager 21 years, 5 months ago
Lesson 9 uses alpha blending to blend out the black around a bitmap. This works fine but it seems to me as if it continues to blend all the other colours too so you can see 1 image below the other. Is there a way to stop this ? Thanks Trager
read the tutorial about masking
Advertisement
Thanks Ruudje I didnt see that tutorial.

I noticed at the bottom of the tutorial it suggests adding an alpha channel to the image and setting the alpha values of each pixel as you desire.

I decided to go for this option as I think it will be more suited to my needs are probably faster too.

The textured plains (sprites) come up fine but the blending still isnt right. I think the problem probably lies in one or both of these two lines.

gluBuild2DMipmaps(GL_TEXTURE_2D,3, stDB_Bitmaps[stDB_Current_Bitmap].Width, stDB_Bitmaps[stDB_Current_Bitmap].Height, GL_RGBA, GL_UNSIGNED_BYTE, stDB_Bitmaps[stDB_Current_Bitmap].Data);


and

glBlendFunc(GL_SRC_ALPHA,GL_ONE);

Can anyone offer any pointers?


Thanks

Trager
I''ve been looking at some old posts and have worked out what the issue is.

Both line are at fault.

The 3 in the first line should be 4.

Blending should be disabled and these 2 lines used instead.

glAlphaFunc(GL_NOTEQUAL,0);
glEnable(GL_ALPHA_TEST);


Thanks all.

Trager

This topic is closed to new replies.

Advertisement