01 Fragments and data
vec2: two numbers in one value
Two floats that together mean X and Y. Drag the numbers in the code and the dot moves.
01
01
Exercise
Drag the underlined numbers left and rightDrag numbers, or edit the code
vec2 point = vec2(, );// these two components place the dot on the left// point.x -> left/right// point.y -> up/down
vec2Two floatsRangeBottom left (0, 0) → top right (1, 1)JS side
gl.uniform2f(uResolution, …, …)A vec2 packs two floats together, often a coordinate. Bottom left is (0,0), top right (1,1).
Try it
- Move the dot to the top right corner
- Put the dot dead centre: what should the two numbers be?