Hello, i am learning . GLSL and have a question how to change shape position on mouse move
Here is my shader:
varying vec3 v_position; //value default is 0,0,0
vec2 u_resolution;
vec2 u_mouse;
void main (void){
vec2 mouse = u_mouse/u_resolution;
float inCircle = 1.0 - step(0.2, length(v_position.xy-vec2(0.5,-0.5)));
vec3 color = vec3 (1.0,1.0,0.0) * inCircle;
gl_FragColor = vec4(color, 1.0);
if i am subtracting vec2 value from v_position i can manually manipulate position of my circle, but by somereason if i replace this vec2 with vec2 mouse it does not work.
Manually changing position works: v_position.xy-vec2(0.5,-0.5)
If i replace it with mouse vec2 does not work: v_position.xy-mouse
vec2 mouse is calculated by mouse position divided by resolution and it technically should output two values 0 to 1.
what i am doing wrong ? (my goal is to make yellow circle following mouse)