Error
boot.lua:514: present cannot be called while a Canvas is active.
Traceback
[C]: in function 'present'
[C]: in function 'xpcall'
I've tried moving setCanvas to update() and moving the newCanvas command outside load(), but the results are the same. I tinkered with canvases a bit in the previous version and don't remember having this problem, so am I correct in assuming this is a bug in 11.2 or am I doing something wrong?
Last edited by DGM on Tue Jan 22, 2019 1:58 am, edited 1 time in total.
When love.draw finishes, you need to have no canvas active, so you need to disable it at some point before the end of love.draw(). This works, for example:
function love.draw()
love.graphics.setCanvas(canvas_1)
-- do stuff here
love.graphics.setCanvas()
end
Of course, drawing only to a canvas in love.draw and not to the screen isn't very useful, but then your example had the same problem; it's only for illustrative purposes. Here's something a bit more useful:
pgimeno wrote: ↑Sun Jan 20, 2019 10:52 pm
When love.draw finishes, you need to have no canvas active, so you need to disable it at some point before the end of love.draw(). This works, for example:
That was the problem. Thanks.
Suggestion to the Love2D devs: a warning about needing to deactivate your canvases in the documentation for the canvas feature might be a good idea.
I've added a paragraph to love.graphics.setCanvas, feel free to correct it if you think the wording could be improved (wiki accounts use the same user/password as the forum). To prevent confusion: I'm not a Love2d dev.