play-co / webgl-2d

Canvas2D API in WebGL
http://weare.buildingsky.net
MIT License
517 stars 117 forks source link

Bezier curves #23

Open nelsonsilva opened 13 years ago

nelsonsilva commented 13 years ago

Hi,

I've added bezier support in my fork (https://github.com/nelsonsilva/webgl-2d).

I haven't submitted a pull request since I want to fix the filling of non convex polygons. If I add each bezier as a subpath the rendering of each of these filled is not the same as filling the whole path. If I add all to a single subpath the use of the triangle fan doesn't work properly for non convex polygons. I have even tried to calculate the lower left of the path and use it as the first point but it still doesn't seem to work properly. Should we add tesselation to fix this ?

cjcliffe commented 13 years ago

Thanks! -- I think the ultimate plan is to attempt this technique:

http://www.mdk.org.pl/2007/10/27/curvy-blues

which we can use to push most of the work onto the GPU -- however it wouldn't hurt to have a starter implementation in the meantime if yours is at least working well for convex.

neave commented 12 years ago

Will support for .quadraticCurveTo() be added as well? Or is there a simple workaround using .bezierCurveTo() somehow? Thanks!