I used two calls love.graphics.stencil() function in my program.
Code: Select all
local function stencil_test()
lg.circle('fill', cx, cy, radius)
end
function love.draw()
local w, h = lg.getDimensions()
lg.setCanvas({canvas, stencil = true})
lg.clear(0.2, 0.2, 0.2)
cx, cy, radius = w/2, h/2, 200
lg.stencil(stencil_test, 'increment')
cx, cy, radius = w/2, h/2, 50
lg.stencil(stencil_test, 'decrement')
--lg.stencil(stencil_test, 'decrementwrap')
lg.setColor(1, 1, 1)
lg.setStencilTest('greater', 0)
lg.rectangle('fill', 0, 0, lg.getDimensions())
lg.setStencilTest()
lg.setCanvas()
lg.draw(canvas)
end
If replace 'decrement" with "decrementwrap", only a smaller circle is visible.
Does calling love.graphics.stencil reset stencil buffer? It looks like this.