Hello, I’m learning about shaders using The Book of Shaders.
The colors displayed on the gl_FragCoord section seems to be rotated in way.
Am I doing something wrong here?
Current:
Expected:
Here is the shader code
const vShader = `
varying vec2 v_uv;
void main() {
v_uv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`;
const fShader = `
varying vec2 v_uv;
uniform vec2 u_resolution;
void main() {
vec2 uv = 2.0 * v_uv - 1.0; // between -1 and 1
uv.x *= u_resolution.x / u_resolution.y;
gl_FragColor = vec4(uv.x, uv.y, 0.0, 1.0);
}
`;