Shader Learn

01 Fragments and data

Screen coordinates and resolution

Pixel position ÷ resolution = a 0–1 screen coordinate.

Pixel position…, …
1100

Runs once per pixelDrag numbers, or edit the code

JS sidegl.uniform2f(uResolution, …, …)

gl_FragCoord is the pixel position; divide by uResolution to get a 0–1 screen coordinate.

Try it

  • Set pixels per cell to 1: every pixel differs
  • Move the pointer and compare the pixel position with the 0–1 coordinate