Note that texture_coords already is a vec2, so vec2 uv = texture_coords.xy does nothing (except make things slower). Also, color is not a vec3, but a vec4 (red, green, blue, alpha).retrotails wrote:...
I think there might be a deeper misunderstanding what a pixel effect does. The function effect() runs on every pixel of things you draw. For an 200x200 image, the effect function is run 200 * 200 = 40000 times, kinda (but not quite) like this:spynaz wrote:So I'm guessing with "texture_coords" you change the position of the rectangle and with "pixel_coords" you change how pixelated it i
Code: Select all
for x = 0,199 do
for y = 0,199 do
image[x][y] = effect(image, color, {x/w,y/h}, {x+ox, y+oy})
end
end
- The image you are drawing (undefined for love.graphics.rectangle and friends).
- The current color, set with love.graphics.setColor(). Caveat: r,g,b and a range not from 0 to 255 but from 0 to 1.
- The coordinates of the pixel relative to the image origin, divided by the width/height of the image. This is also known as texture coordinates.
- The coordinates of the pixel on the screen.