gl_FragCoord

Using the vec4 gl_FragCoord default input to vary the pixel colour based on position within the canvas. Normalise the coordinate of the fragment by dividing it by the total resolution of the canvas.

The resulting image highlights that (0,0) is positioned in the bottom left hand corner. With up being positive X and right being positive Y.

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;

void main() {
    vec2 st = gl_FragCoord.st/u_resolution;
    gl_FragColor = vec4(st.x,st.y,0.0,1.0);
}
					

A few variants on the theme

Adding in some mouse movement:

Based on 'gl_FragCoord' - https://thebookofshaders.com