Custom blending functions




OpenGL is unable to do component alpha blending (in a single pass) and gamma correction (without extensions). In your application recommendations, you state that blending is done by the USSE pipeline. If that's the case, wouldn't it make sense to introduce an extension to read the destination color from the fragment shader? These things are pretty critical for font rendering, and it would be nice if they could be done efficiently.


EDIT: There seems to be an extension that allows component alpha blending with an solid color (with is pretty much all fonts). Luckily this was included in OpenGL ES 2.0, so unless the driver does something crazy (like changing shaders with glBlendColor) so this point is mostly resolved.

EDIT:Â glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_SRC_COLOR) doesn't seem to be supported in PVRFrame.

EDIT: There's a range check in glBlendFunc which doesn't include the new ES blending functions. Skipping this range check makes it work.



Zoxc2010-07-08 18:24:15

Just stumbled myself, such a simple blending like glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_DST_COLOR) is also not supported, is this a bug or something?

Hi,





Yes, those unsupported combinations are indeed a bug in PVRVFrame, thanks for reporting. As a workaround you should be able to use glBlendFuncSeparate.

I’m a bit surprised this is not fixed yet.