I struggled with this problem for a long time and tried every drawing order and combination of glColorMask
and glBlendEquation
. In the end I realised there's a very simple solution — premultiplied alpha.
In my 'smooth shape' drawing routine, rather just than drawing the outer smoothing edge as same colour, alpha=0
, I allowed the outer smoothing colour to be specified. For the yellow shape I specified the black colour, and that gave me a smooth edge at the same time as the overall shape having a smooth edge — even though the yellow shape's right-hand edge isn't masked by the alpha channel.