Convert coordinates for shader

Hello!
i ve a problem to pass mouse coordinates to a shader:
im doing this in OF:

    glm::vec3 pp = glm::vec3(ofGetMouseX(), ofGetMouseY(), 0);
    firstPass.shader.setUniform3f("pos",pp);

and in the shader

**vec2** toCenter = **vec2** (0.5)-pos.xy;

**float** angle = atan(toCenter.y,toCenter.x);

**float** radius = (length(toCenter));

but this dont get the derise effect ( just draw a circle around that coordinate)
what im doing wrong?
I know that im receiving the information, becouse i tried to put that values into a mix function, but with weird results

Hi,
Have you tried to take examples/shader/03_simpleShaderInteraction as a starting point?
Iā€™m not very experienced with shaders, but the example seems to be passing the coordinates just fine.

1 Like

Thanks! the key was in vertex shader, im only need to rest the pixel position - mouse positions

mPos = pos.xy - mousePos;