Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Array is empty

edited June 2017 in Shaders Posts: 15

I am trying to pass an array of vec2 in to the fragment shader but it's empty
Here is my code I don't know what I'm doing wrong
` -- my lua code

-- Use this function to perform your initial setup
function setup()

    m = mesh()
    m.shader = shader("Project:Balls")
    m:addRect(WIDTH/2, HEIGHT/2, WIDTH-50, HEIGHT-50)
    m.points = {vec2(1, 1), vec2(1, 1)}
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    m:draw()

end

Fragment shader v

precision highp float;
uniform vec2 points[2];

void main(){
    if (points[1] == vec2(1,1)) {
        gl_FragColor = vec4(0,1,0,1);
        }
    else{
        gl_FragColor = vec4(1,0,0,1);
    }
}

`

Comments

Sign In or Register to comment.