I just learned how to properly use a stencil with a canvas, but it only works with setCanvas. Is there any way to use it with renderTo as well? Since renderTo is just a shortcut to setCanvas, but it doesn't seem to support stencil unless I'm using it wrong.
I just like to use renderTo because it's cleaner looking.
Possible to use stencil with Canvas:renderTo?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Possible to use stencil with Canvas:renderTo?
No, we'd need a renderTo which accepts {stencil = true}.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Possible to use stencil with Canvas:renderTo?
Maybe they can add it somehow? Would be nice. Thanks. At least I know I'm not missing something. lol
Re: Possible to use stencil with Canvas:renderTo?
This would definitely be a good addition. Perhaps you could use a temporary hack for now, like this:
This way canvas:renderTo(function() end, true) would enable the stencil buffer.
Perhaps they could add vararg support also? It's a shame you can only pass a function to it.
Code: Select all
local Canvas_mt = debug.getregistry().Canvas
local renderTo = Canvas_mt.renderTo
function Canvas_mt:renderTo(func, stencil)
if stencil ~= true then
return renderTo(self, func)
end
local orig_canvas = love.graphics.getCanvas()
love.graphics.setCanvas { self, stencil = true }
func()
love.graphics.setCanvas(orig_canvas)
end
Perhaps they could add vararg support also? It's a shame you can only pass a function to it.
Who is online
Users browsing this forum: No registered users and 6 guests