1. Anders Ruud
  2. love
  3. Issues


Issue #610 invalid

love.graphics.polygon( 'fill' ) draws both a concave and a convex polygon

Anonymous created an issue

Version 0.8.0: polygon('fill') draws both a concave and a convex polygon for a single set of coordinates. polygon('line') behaves as expected. sample code:

coordinates = { 37,215,290,215,290,28,543,28,543,402,37,402 }

function love.draw( ) love.graphics.setColor( 128,128,128,128 ) love.graphics.polygon( 'fill', coordinates ) end

Comments (1)

  1. Matthias Richter

    Marking this invalid, since it is expected behavior. From the documentation:

    Note: when in fill mode, the polygon must be convex and simple or rendering artifacts may occur.

    0.9 introduces love.math.triangulate() which you can utilize to draw filled non-convex polygons:

    triangles = love.math.triangulate(coordinates)
    for _, t in ipairs(triangles) do love.graphics.polygon('fill', t) end
  2. Log in to comment