# Help me to understand glBlendFunc..

Hi… i’m a newbee

I have a problem to understand glBlendFunc(sfactor,dfactor);

what is the influence from sFactor and dFactor parameter

i read in the article glBlendFunc(GL_DST_COLOR,GL_ZERO) and glBlendFunc(GL_ONE,GL_ONE) is for masking…

where those come from?

it said Kr = 2^Mr - 1

what is Kr and Mr for?

if you have a time please give me some case example with the calculation

thanks …

Besides the calculations the formula looks like

pixel_color_out = actual_color_fb * dstFactor + pixel_color_in * srcFactor

(it’s really somewhat more complicated than that but let’s keep it simple for the purpose)

Don’t try to think it in the range 0-255, think as everything is normalized in [0…1] range.

So, BlendFunc(ONE, ONE) does
colorOut = actualColor * (1 1 1 1) + colorIn * (1 1 1 1)
colorOut = min(colorOut, 1);
Result is so called ‘additive blending’, good for sparks and energy like stuff.

BlendFunc(SRC_ALPHA, ONE_MINUS_SRC_ALPHA)
Is standard transparency (well, I realize I might have swapped the two tokens). So, the result is a mixture of the color already in framebuffer and the color which the video card is trying to write in this render pass.

Since I also hardly remember the behaviour of this func, I usually like to read something from this , it has some interesting examples which can be useful for beginners.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.