View Full Version : How to dealed with Alpha value by glBlendFunc( )

06-18-2003, 08:26 AM

In glBlendFunc, I should guess that alpha value A in color(R,G,B,A) is used for blend factor.

Well, I can't explain about next case:
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
src color : (0, 0, 0, 1.0f)
dst color : (0.7f, 0.5f, 0.5f, 1.0f)

<my explanation for e.g.1>
src blending factor is (1,1,1,1).
dst blending factor is (1,1,1,1).
new destination color is
(1*0+1*0.7f, 1*0+1*0.5f, 1*0+1*0.5f, 1*1.0f+1*1.0f) = (0.7f, 0.5f, 0.5f, 2.0f(??))
#new dst color's alpha value is 2.0f??

Is this above explain all right?
Can alpha value have 2.0f value?

If you have any advice, please point out above explain and I'm glad to hear your advice.

sorry, my immature English.

06-18-2003, 10:31 AM
The calculation is correct, the resulting alpha will be 2. But this is only the output of the blending stange, when written to the frame buffer it will be clamped to the range [0, 1], so 1.0 is the actual value you get if you read it back later.

06-18-2003, 05:44 PM
Thank you very much for your replay.
My question was brought to a settlement.

I'm glad to hear your advice.