Help with applying Shader on love.graphics shapes[SOLVED!]
Posted: Thu Jun 28, 2018 5:05 am
Hi! I found this shader and I'm trying to modify it to work on love's built-in shape functions. I'm not very familiar with GLSL and would like assistance on this problem. Thank you!
Here is some code:
Here is some code:
Code: Select all
-- Shader Code
Distortion = love.graphics.newShader([[
extern number time;
extern number size;
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords){
vec2 p = texture_coords;
p.x = p.x + .1 * cos(p.y * size + time) ;
p.y = p.y + .1 * sin(p.y * size + time) ;
return Texel(texture,p);
}
]]
-- ....
-- in love.draw method
love.graphics.setShader(Distortion)
love.graphics.draw(penguin,Screen.mouseX - penguin:getWidth()/4,Screen.mouseY- penguin:getHeight()/4,0,0.5,0.5)
love.graphics.circle("fill",Screen.mouseX ,Screen.mouseY,100)
love.graphics.circle("line",Screen.mouseX ,Screen.mouseY,150)
love.graphics.setShader()