Page 1 of 1

love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 1:32 am
by davisdude
It came to my attention that, when paired with STI, Brady, my camera library, drew certain portions that should not have been drawn. When I use love.graphics.setScissor, it worked, though.

It works regularly when I comment out the lines from STI pertaining to drawing to a canvas, but not with the canvas.
Is this the intended result? Am I missing something?

(.love's are over on this thread if you're interested)

Re: love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 5:49 am
by arampl
What .love you are referring to: MV Platformer or BWE?
In both cases setShape function is never called.
Tried MV Platformer with LÖVE 0.10.0 (adapted several functions including stencil related) and it works (all is clipped to rectangular region in the top left corner).
If this is not what is needed then how result should look like? Or is this wrong .love files?

Re: love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 1:24 pm
by davisdude
Can confirm with 0.10.0 (and proper porting) it works as expected. Does NOT work with 0.9.2.

You can use both:
MV Platformer is demonstrating the problem.
BWE comments out lines in STI that set canvases, and it works as expected.

Re: love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 2:31 pm
by arampl
It seems that setting / unsetting canvases cancels any defined stencils in 0.9.2:

Code: Select all

local lg = love.graphics
local canvas

function love.load()
	canvas = lg.newCanvas(800, 600)
end

function love.draw()
	lg.setStencil(function() lg.rectangle("fill", 100, 100, 200, 200) end)

	lg.setCanvas()

	lg.setColor(0, 100, 0)
	lg.circle("fill", 150, 150, 100)
end

Re: love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 2:48 pm
by davisdude
Yeah, that's what I was noticing. Is this intended?

Re: love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 3:41 pm
by arampl
Oh, I've thought question was about problems inside .love.

Re: love.graphics.setStencil not applying over canvases?

Posted: Sun Oct 18, 2015 4:38 pm
by slime
Stencils are effectively per-Canvas in all versions of LÖVE. The new stencil APIs in 0.10.0 make it a bit more obvious/explicit.