Inverted y pos of circle

I am using to run my code and i am trying to draw a circle around the mouse i have this code:

precision highp float;

in vec2 uv;
out vec4 out_color;

uniform vec2 u_resolution;
uniform float u_time;
uniform vec4 u_mouse;

void main(){
    vec2 st = uv * vec2(u_resolution.x / u_resolution.y, 1.);

    vec2 mouse = u_mouse.xy / u_resolution;
    float l_time = u_time;
    if(distance(u_mouse, gl_FragCoord) < 50.0 ){
        out_color = vec4(1);
        out_color = vec4(0, 0, 0, 1);

and it draws the circle at the opisite y of the mouse but the x looks fine how would i make the y of the circle be the same as the mouse?

Adjust u_mouse.y to u_resolution.y - u_mouse.y so that the mouse y position is measured from the opposite side of the screen/window.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.