Unfortunately, OpenGL polygon mode does not handle polygons which
either intersect themselves or are not convex. This needs to be done
one level higher than the OpenGL API. We hope to expose closed curves
at some point, but for now, you need to do this yourself–i.e. break
your polygon into chunks which are convex. I’ll try to find time to
make a JS example of taking a list of points that make up a polygon
and breaking it into convex chunks.