mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.54k stars 260 forks source link

fragCoord is broken #80

Closed aaronzshey closed 2 years ago

aaronzshey commented 2 years ago

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

aaronzshey commented 2 years ago

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

aaronzshey commented 2 years ago

https://twitter.com/mrdoob/status/1524897052005748737?s=20&t=6ztwYcV5lFLEM-LpKsh0dg Straight from the mouth of god himself!