constant blending with RGBA textures?

I would like to blend the output of a fragment program with the framebuffer at a constant (= not per pixel) value and still preserve the alpha values coming from the fp.
Looking for a solution without changing the fp…

Are there any extensions for this that I am not aware of?

I never tried this, but according to the spec (I looked in 1.5 and 2.0, not sure about earlier versions) there are the following blend modes that might be useful:

GL_CONSTANT_COLOR
GL_ONE_MINUS_CONSTANT_COLOR
GL_CONSTANT_ALPHA
GL_ONE_MINUS_CONSTANT_ALPHA

They mean that the source and/or destination will be multiplied by a constant. This constant can be set with the glBlendColor call.

You might also look into glBlendFuncSeperate, with it you can set seperate blend equations for color and alpha, so you can blend the color and leave the alpha value unmodified. This function is also in core OpenGL (AFAIK since 1.4).

Thanks Overmind, I should have just browsed the extension registry:

GL_EXT_blend_color
GL_EXT_blend_func_separate
GL_EXT_blend_equation_separate

It’s all there. I feel like I have been missing out on something… :eek:

… and I should really update my Blue Book 1.0 :smiley: