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' :
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 ?
lg.plygon gone wild [solved]
- pakoskyfrog
- Citizen
- Posts: 62
- Joined: Mon Feb 04, 2013 12:54 pm
- Location: France
lg.plygon gone wild [solved]
Last edited by pakoskyfrog on Sun Feb 24, 2013 6:41 pm, edited 1 time in total.
Re: lg.plygon gone wild
Yes, the fill mode needs the polygon to be simple and convex or the results may be buggy: love.graphics.polygon, 4th line
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- pakoskyfrog
- Citizen
- Posts: 62
- Joined: Mon Feb 04, 2013 12:54 pm
- Location: France
Re: lg.plygon gone wild [Answered]
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 >.<
Okay... lg.polygon just became from quite useful to almost useless...
Now, i "just" have to write my own >.<
-
- Citizen
- Posts: 65
- Joined: Sat Dec 22, 2012 8:17 am
Re: lg.plygon gone wild
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.
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.
- pakoskyfrog
- Citizen
- Posts: 62
- Joined: Mon Feb 04, 2013 12:54 pm
- Location: France
Re: lg.plygon gone wild
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
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
Who is online
Users browsing this forum: CharlesAceta and 2 guests