EDIT 2: I just realized I'm using extern instead of uniform, that doesn't fix the issue (same problem)
Do you people see anything wrong with this? I'm building an app related to color palettes and I was able to isolate the issue:
Code: Select all
shader = love.graphics.newShader([[
extern vec3 colors[3];
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
vec4 pixel = Texel(texture, texture_coords);
number average = (pixel.r + pixel.g + pixel.b) / 3.0;
for (int i = 0; i < 46; i++) {
vec3 color = colors[i];
}
return pixel;
}
]])
function love.update(dt)
shader:send('colors', {1, 0, 0}, {0, 1, 0}, {0, 0, 1})
end
function love.draw()
love.graphics.setShader(shader)
love.graphics.setColor(1, 1, 0)
love.graphics.rectangle("fill", 0, 0, 800, 600)
love.graphics.setShader()
end
EDIT 3: tried an even simpler version, same issue:
Code: Select all
shader = love.graphics.newShader([[
uniform vec3 colors[3];
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) {
vec4 pixel = Texel(texture, texture_coords);
vec3 c = colors[0];
return pixel;
}
]])
function love.update(dt)
shader:send('colors', {1, 0, 0}, {0, 1, 0}, {0, 0, 1})
end