local function compose_canvas(x, y)
--love.graphics.clear()
love.graphics.setCanvas(canvas)
love.graphics.setColor(0.8, 0.9, 0.4)
love.graphics.rectangle("fill", x, y, 100, 100)
love.graphics.setCanvas()
end
function love.load()
canvas = love.graphics.newCanvas()
compose_canvas(0, 0)
end
function love.draw()
love.graphics.draw(canvas, 200, 100, 0, 0.5, 0.5)
end
The problem I have is that calling the compose_canvas function with other parameters, still remains the original one, and does not changes.
I tried with love.graphics.clear() but then the first canvas is created but in the second call dissapears.
Any idea?
Last edited by runs on Wed Sep 22, 2021 8:11 pm, edited 1 time in total.
local function compose_canvas(x, y)
--love.graphics.clear()
love.graphics.setCanvas(canvas)
love.graphics.clear()
love.graphics.setColor(0.8, 0.9, 0.4)
love.graphics.rectangle("fill", x, y, 100, 100)
love.graphics.setCanvas()
end
function love.load()
canvas = love.graphics.newCanvas()
compose_canvas(0, 0)
end
function love.draw()
love.graphics.draw(canvas, 200, 100, 0, 0.5, 0.5)
end
veethree wrote: ↑Tue Sep 21, 2021 3:36 pm
If i'm understanding you right, You just need to add love.graphics.clear() right below love.graphics.setCanvas(canvas)
local function compose_canvas(x, y)
--love.graphics.clear()
love.graphics.setCanvas(canvas)
love.graphics.clear()
love.graphics.setColor(0.8, 0.9, 0.4)
love.graphics.rectangle("fill", x, y, 100, 100)
love.graphics.setCanvas()
end
function love.load()
canvas = love.graphics.newCanvas()
compose_canvas(0, 0)
end
function love.draw()
love.graphics.draw(canvas, 200, 100, 0, 0.5, 0.5)
end
I tried, but simply the canvas dissapears, it does not redraw.