Why is that, and what can I do to draw all of them to the same canvas?
main.lua for your convenience:
Code: Select all
function love.load()
canvas = love.graphics.newCanvas(100, 100 * math.sin(1/3 * math.pi))
end
function love.draw()
love.graphics.setCanvas(canvas)
canvas:clear()
local drawWidth = canvas:getWidth()
local drawHeight = canvas:getHeight()
local middleY = 3/5
love.graphics.setColor(255, 0, 0)
love.graphics.polygon("fill",
0.5 * drawWidth, middleY * drawHeight,
1.0 * drawWidth, 1.0 * drawHeight,
0.0 * drawWidth, 1.0 * drawHeight)
love.graphics.setColor(0, 255, 0)
love.graphics.polygon("fill",
0.5 * drawWidth, middleY * drawHeight,
0.5 * drawWidth, 0.0 * drawHeight,
1.0 * drawWidth, 1.0 * drawHeight)
love.graphics.setColor(0, 0, 255)
love.graphics.polygon("fill",
0.5 * drawWidth, middleY * drawHeight,
0.5 * drawWidth, 0.0 * drawHeight,
0.0 * drawWidth, 1.0 * drawHeight)
love.graphics.setCanvas()
love.graphics.draw(canvas)
end