(Solved)I made a shader but only works on image
Posted: Sat Jan 11, 2014 6:37 am
Code: Select all
function love.load()
love.window.setMode(800,450)
local src = [[
vec4 effect(vec4 color, Image texture, vec2 tc, vec2 pc)
{
return vec4(tc.x, tc.y, 1.0, 1.0);
}
]]
effect = love.graphics.newShader(src)
img = love.graphics.newImage("img.png")
end
function love.draw()
love.graphics.setShader()
love.graphics.setColor(255, 255, 255)
--love.graphics.draw(bg, 0, 0)
love.graphics.setShader(effect)
love.graphics.draw(img, 400, 200)
love.graphics.rectangle('fill',0, 0, 200, 200)
end
function love.update(dt)
if love.keyboard.isDown('escape') then
love.event.quit()
end
end
it works on img but doesnt work on rectangle
can anyone help me?