View Full Version : Using alpha values
bonzovt
04-14-2003, 06:40 AM
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!
Deiussum
04-14-2003, 07:18 AM
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
You can also put alpha channel in your texture then use DECAL env. mode. The texture color will get multiplied with texture alpha.
bonzovt
04-14-2003, 11:10 AM
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?
Deiussum
04-15-2003, 04:15 AM
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.
deadalive
04-15-2003, 03:44 PM
Quick question does z-fighting occur gluOrtho2D projections?
Deiussum
04-16-2003, 04:38 AM
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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.