Skip to main content
GameDev.net gamedev.net
🔒 Locked

glBlendFunc

Started by EiNDouble Jul 2, 2010 at 5:55 AM 1 replies 850+ views
Original Post
EiNDouble
EiNDouble
Hi,

I'm having a hard time trying to figure out the correct blend function I want.

I want the source color to be multiplied by the alpha of the destination, and this I already achieved with glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA), so this way the source will be painted according to the alpha of the dst.

What I want as well is the source color to be multiplied by the source alpha, for cases where the source is a png texture with transparency. The blend function for this would be glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).


So, if I want both of them together, multiplying the source color by the destination alpha and the source alpha as well, I think I would want something like glBlendFunc(GL_DST_ALPHA * GL_SRC_ALPHA, ...).


Is there anyway to achieve this?

Thank you :)
Simon_Roth
Simon_Roth
What version of opengl are you using?

You would be best off doing this in a shader and dropping the fixed function blending.
EiNDouble
EiNDouble
I'm using the v2.0 .

I know, but for this particular situation I wanted to avoid shaders at all costs..

And btw, what I'm trying to do is recursive masking.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.