   Untitled
  Hi,I'm programming a multi-layer painting app and I'm currently struggling with the blending operations. This is where I am today :- when I project the brush image on a layer, I use the classical blending equation : COL = COLsrc * ALPHAsrc + COLdest (1 - ALPHAsrc). This gives ugly results, i.e. a halo at intermediate alphas (at the edge of the brush image). - looking at the blending equations, this is logical, as shown in the example : color = red(src) * 0.5 + blue(dest) * (1 - 0.5) = purple ; this is OK if the destination is opaque purple, but if the destination is transparent at that pixel, the purple color is unwanted.- glBlendFuncSeparate improves somewhat, but there are still similar problem.- after playing a little with the blending equations, I came to the conclusion that no standard openGL blending function would do the job. Anybody familiar with painting on layers with openGL ? Is there a site that covers this specific quaestion ? If not, how can I blend two layers without using the built-in blending operation ? Thanks   
  Layer = texture.  You can draw a fullscreen quad with a fragment shader and your two layers as texture samplers to blend them however you want.Quote:color = red(src) * 0.5 + blue(dest) * (1 - 0.5) = purpleYes . . . that's what should happen.  In subtractive color space, you get purple, and in additive color space you get magenta (a sort of purple).  What are you looking for when you blend red and blue?  Are you going for a mask on your background layer or something?   