Cocos2d-x v3 Anti-Aliasing for Primitives

Guys! I almost have it! The lines are antialiased when I comment out the smoothstep part:

gl_FragColor = v_color*smoothstep(0.0, length(fwidth(v_texcoord)), 1.0 - length(v_texcoord));\n  

BUT! You need to remove also the fwidth part from this function so in the end the line looks like this:

gl_FragColor = v_color*smoothstep(0.0, length(v_texcoord), 1.0 - length(v_texcoord));\n

The sad part about this solution is that this blurs ONLY the drawDot part:

dot->drawDot(end, DOT_RADIUS / 2.0, color);  

The solidPoly is not being blurred:

dot->drawSolidPoly(poly, 4, color);

Why is it so? Or how can I replace the SolidPoly part so I get a line without holes in it? Because when I comment out the SolidPoly part I will draw only Dots and when I move my finger fast I get holes in the line I draw. I’m so close yet so far! :frowning: HELP!

1 Like