Specific blending mode (how to achieve this?)

Hey

Does opengl provide a blending mode, which would operate like this:
1)RGB values of destination and source are multiplied
2)Alpha values of destination and source are added

If not then how would you go about achieving that?

Thanks

You’re asking for a blend equation multiply and it does not exist.

glBlendEquation does not support this. <<<< Edit to say this is bullshit

The simplest and probably fastest way is to render to texture and use multi-texture modulation

New HW and APIs have some programmable blend that should come to the rescue soon but not on most hardware out there now.

Depending on how specific your usage case is you could mask teh color buffers and output red channel as alpha and multiply destination by source alpha, then repeat for g and b.

You can certainly use a vertex shader for this ?

You can use glBlendFuncSeparate to give the RGB and Alpha different blending parameters.

You’re asking for a blend equation multiply and it does not exist.

Sure it does:

glBlendEquation(GL_ADD);
glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_ONE, GL_ONE);

No, absolutely not.

Sorry brain fart.

I’ve used DST_COLOR and SRC_COLOR for blending before so I was being a dumbass.

Thanks for the correction.

Dumb.

Thanks everybody, glBlendFuncSeparat did the trick