I'm trying to pass the mouse coordinates into a shader as a vec2 but it seems to be just setting a static and incorrect value and I'm not sure why.
Shader (relevant parts).
This "works" but the mouseCoord doesn't change based on the mouse position at all.
Obj Draw
Any help would be greatly appreciated!
Shader (relevant parts).
This "works" but the mouseCoord doesn't change based on the mouse position at all.
Code:
uniform vec2 mouseCoord;
void main(void)
{
vec2 res = vec2(512.0);
vec2 uv = fragCoord.xy*2. / res-vec2(1.);
//shadow
vec3 base = mix(vec3(0.0),vec3(circle(uv,mouseCoord,0.5)),0.75);
}
Code:
var m_x = mouse_x/room_width
var m_y = mouse_y/room_height
if enabled //only apply shader if the enabled = 1
{
var shader_params_m = shader_get_uniform(shader3, "mouseCoord");
shader_set_uniform_f(shader_params_m,m_x,m_y)
shader_set(shader3)
}
draw_background(background,0,0)
shader_reset()
draw_text(16,48,string_hash_to_newline("Mouse Pos: "+string(m_x) + "/" + string(m_y)))