mrdoob/glsl-sandbox

fragCoord is broken

aaronzshey opened this issue · 2 comments

I used the following code block:

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;

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

Using the Book of Shaders editor, it looks like this:

image

But when I use the glsl sandbox, I get to see a beautiful blaring yellow:
https://glslsandbox.com/e#81113.0

image

I don't see any errors in the console. I'm using Opera browser Version:85.0.4341.60, and this is my system info:

Operating System: Ubuntu 21.10
Kernel: Linux 5.13.0-40-generic
Architecture: x86-64
Hardware Model: MacBookPro11,4

So I figured out the problem - the correct variable is uniform vec2 resolution, not u_resolution. Why isn't u_resolution supported?