Available since LÖVE 0.8.0
It has been renamed from love.graphics.setRenderTarget.
Captures drawing operations to a Canvas.
Sets the render target to a specified Canvas. All drawing operations until the next love.graphics.setCanvas call will be redirected to the Canvas and not shown on the screen.
love.graphics.setCanvas( canvas )
Canvas canvas
Nothing.
Resets the render target to the screen, i.e. re-enables drawing to the screen.
love.graphics.setCanvas( )
None.
Nothing.
Available since LÖVE 0.9.0
This variant is not supported in earlier versions.
Sets the render target to multiple simultaneous Canvases. All drawing operations until the next love.graphics.setCanvas call will be redirected to the specified canvases and not shown on the screen.
love.graphics.setCanvas( canvas1, canvas2, ... )
Canvas canvas1
Canvas canvas2
Canvas ...
Nothing.
Normally the same thing will be drawn on each canvas, but that can be changed if a pixel shader is used with the effects
function instead of the regular effect
.
All canvas arguments must have the same widths and heights and the same texture type. Not all computers which support Canvases will support multiple render targets. If love.graphics.isSupported("multicanvas") returns true, at least 4 simultaneously active canvases are supported.
function love.load() -- create canvas canvas = love.graphics.newCanvas() -- direct drawing operations to the canvas love.graphics.setCanvas(canvas) -- draw colored square to canvas love.graphics.setColor(230,240,120) love.graphics.rectangle('fill',0,0,100,100) -- re-enable drawing to the main screen love.graphics.setCanvas() end function love.draw() -- draw scaled canvas to screen love.graphics.setColor(255,255,255) love.graphics.draw(canvas, 200,100, 0, .5,.5) end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.setCanvas