I saw that you can do
Code: Select all
love.graphics.setCanvas(canvas1, canvas2)
Code: Select all
local pixelcode = [[
void effects(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords)
{
// love_Canvases is a writable array of vec4 colors. Each index corresponds to a Canvas.
// IMPORTANT: If you don't assign a value to all active canvases, bad things will happen.
love_Canvases[0] = color;
love_Canvases[1] = color + vec4(0.5);
// etc.
}
]]
local testshader = love.graphics.newShader(pixelcode)
local w, h = love.graphics.getDimensions()
local canvas0 = love.graphics.newCanvas(w, h)
local canvas1 = love.graphics.newCanvas(w, h)
function love.draw()
love.graphics.setCanvas(canvas0, canvas1)
love.graphics.setShader(testshader)
love.graphics.setColor(255, 0, 0, 255)
love.graphics.polygon("fill", 100, 100, 200, 100, 200, 200, 100, 200)
love.graphics.setCanvas()
love.graphics.setShader()
love.graphics.draw(canvas0)
end
But when I run it in love-11.1.0-win64 and up, it throws me this error:
Code: Select all
Error
main.lua:12: bad argument #1 to 'newShader' (missing 'position' or 'effect' function?)
Traceback
[C]: in function 'newShader'
main.lua:12: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'