set_blend
Description:
If not already familiar; please refer here for an overview of what blend strings are, and their syntax.
Use cogl_pipeline_set_blend
instead
Blending occurs after the alpha test function, and combines fragments with the framebuffer.
Currently the only blend function Cogl exposes is ADD
. So any valid blend statements will be of the form:
<channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))
The brackets around blend factors are currently not optional!
This is the list of source-names usable as blend factors:
- SRC_COLOR: The color of the in comming fragment
- DST_COLOR: The color of the framebuffer
- CONSTANT: The constant set via set_blend_constant
The source names can be used according to the color-source and factor syntax, so for example "(1-SRC_COLOR[A])" would be a valid factor, as would "(CONSTANT[RGB])"
These can also be used as factors:
- 0: (0, 0, 0, 0)
- 1: (1, 1, 1, 1)
- SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])
Remember; all color components are normalized to the range [0, 1] before computing the result of blending.
Blend Strings/1:
Blend a non-premultiplied source over a destination with premultiplied alpha:
"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
"A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
Blend Strings/2:
Blend a premultiplied source over a destination with premultiplied alpha
"RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
The default blend string is:
RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
That gives normal alpha-blending when the calculated color for the material is in premultiplied form.
Parameters:
this |
A |
blend_string |
A Cogl blend string describing the desired blend function. |
Returns:
|