GLSL Fragment Shader not modifying output colour

The shaders compile (I have confirmed this by purposefully making the GLSL code error). In addition, the program is created and linked correctly, as I have checked by printing the value of program and it was non-zero. However, I am still faced with a blue window (from glClearColor), and not a red one, as I… Read More GLSL Fragment Shader not modifying output colour

In GLSL (WebGL), how can I get the screen pixel X position in the fragment shader?

Initially I was using just gl_FragCoord.x which works great up to a point. However the range of gl_FragCoord.xy is between 0.5 and 1023.5, so after 1023.5 x just returns the same value. I have a uniform with the actual canvas size. uniform vec2 resolution; void main(void) { float pixelXPos = ? } Assuming the width… Read More In GLSL (WebGL), how can I get the screen pixel X position in the fragment shader?