Page 1 of 1
lg.plygon gone wild [solved]
Posted: Sun Feb 24, 2013 5:31 pm
by pakoskyfrog
In one of my projects, i use the command love.graphics.polygon('fill', pointList) and the filling is a bit off...
To verify, i make my code to do both 'line' and 'fill' :
- Capture-gone.PNG (10.93 KiB) Viewed 2395 times
And, as you can see, both commands don't show the same results !
Any particular reasons why the filling doesn't follow the outer line ?
Something to do with convexity ?
Re: lg.plygon gone wild
Posted: Sun Feb 24, 2013 5:43 pm
by Nixola
Yes, the fill mode needs the polygon to be simple and convex or the results may be buggy:
love.graphics.polygon, 4th line
Re: lg.plygon gone wild [Answered]
Posted: Sun Feb 24, 2013 5:50 pm
by pakoskyfrog
How did i missed that line ...
Okay... lg.polygon just became from quite useful to almost useless...
Now, i "just" have to write my own >.<
Re: lg.plygon gone wild
Posted: Sun Feb 24, 2013 5:55 pm
by spectralcanine
You can write an algorithm to split it to convex polygons.
The easiest way is to split it to triangles, because that requires no computations whatsoever, but you get the gist.
By the way, this isn't really related to Love2D but rather to OpenGL. That's why polygons were removed ages ago.
Re: lg.plygon gone wild
Posted: Sun Feb 24, 2013 6:08 pm
by pakoskyfrog
I suspected openGL
But since i just want to draw what's underneath my floor, i made a quadrature. Seems to work fine without much perf decrease.
Triangular meshing is not for now xD