Using alpha values

How can I create a polygon that is semi transparent? I know that you can use glColor4f and that the last parameter is the alpha value with 1.0 being totally “solid.” I have tried using this function but it isn’t working. What else to I need to include to get the alpha values to work properly? Thanks!


You can also put alpha channel in your texture then use DECAL env. mode. The texture color will get multiplied with texture alpha.

That helped, but now if I put in a value of say 0.3 for alpha, I have a flashing polygon instead of just a polygon that is 0.3 transparent. How do you get the flashing to stop?

You may be seeing z-buffer fighting. What do you use for your near and far clip planes? If the difference is too big, your z-buffer might not be able to differentiate between 2 polygons that are close to each other.

Quick question does z-fighting occur gluOrtho2D projections?

Yes, it can. If for instance the difference between your near and far clip plane is 1,000,000,000 and you only have a z-buffer with 16-bits of precision, you are going to see a lot of z-fighting because a 16-bit number can only store 65,536 different values.