I've successfully drawn two smooth shapes in OpenGL using a routine that generates a triangle strip whose outermost edge line has all its vertices at alpha 0
. Now I want to intersect them, but I always seem to lose one shape's smooth edges. Here's the code I'm using:
// Draw: smooth black shape as normal
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
// Draw: smooth black shape into alpha channel
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glBlendFunc(GL_DST_ALPHA, GL_SRC_ALPHA);
// Draw: Yellow overlay shape with black shape's alpha
// Reset blending modes for rest of program
And here's the result (at bottom) — the yellow shape loses its smooth right-hand edge because the alpha in those pixels is now 1. How can I get a smooth intersected shape?