01 Fragments and data
Screen coordinates and resolution
Pixel position ÷ resolution = a 0–1 screen coordinate.
Pixel position1100
Exercise
Runs once per pixelDrag numbers, or edit the code
JS side
gl.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