Using a shader - solved

I have made a timer shader based on the arc shader which should show a countdown like timer and it works fine in the shader lab, but when I try to use it in a project it doesn’t work. there are no error messages, just a blank screen. Am I doing something wrong?

-- Main
displayMode(STANDARD)

function setup()
    
    timeshader={
    vertexShader=[[
    //
// Vertex shader: Timer
//

uniform mat4 modelViewProjection;

attribute vec4 position;
attribute vec2 texCoord;

varying highp vec2 vTexCoord;

void main() {
    vTexCoord = texCoord;
    gl_Position = modelViewProjection * position;
}

    ]],
    fragmentShader=[[
    //
// Fragment shader: Timer
//

precision highp float;

uniform float size;
uniform float a1;
uniform float a2;
uniform vec4 color;

varying vec2 vTexCoord;

void main() {
    vec4 col = vec4(0.0);
    vec2 r = vTexCoord - vec2(0.5);
    float d = length(r);
    if (d > size && d < 0.5) {
// this pixel is within the outer and outside the inner ring(s)
        float a = atan(r.y, r.x);
        if (a2 > a1) {
            if (a > a1 && a < a2) {
                col = color;
            }
        } else {
            if (a > a1 || a < a2) {
                col = color;
            }
        }
    }
    gl_FragColor = col;
}
    ]]
    }

    m = mesh()
    
    m.shader = shader(timeshader.vertexShader,timeshader.fragmentShader)
    
    r=m:addRect(0, 0, 0, 0)
    -- m:setRectColor(i, 255,0,0)
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color
    background(0, 0, 0, 255)

    -- This sets the line thickness
    strokeWidth(5)
    m:setRect(r,WIDTH/2,HEIGHT/2,100,100)
    m.shader.a1=math.fmod(ElapsedTime,math.pi*2)-math.pi
    m.shader.a2=-math.pi
    m.shader.color=vec4(0,1,0,1)
    m.shader.size=0.2
    
    -- Draw the mesh
    m:draw()
end

```

rIdx needs to have a size! The last two parameters of addRect need to be much greater then 0 (width and height)

@Luatee i fixed that but it stil won’t work

The shader doesn’t work in the shader lab for me.

Another problem might be the color uniform’s value, though. You want to set it to color(255,255,0,255), not vec4(1,1,0,1).

Sorry this was my fault. I didn’t supply the correct uniforms.
The code should work now