GLSL
vector data types simplify working with vertex data
- Consider a 4-component vector
vec4 v
- Access components by name or index:
- by name
v.x
- or by index
v[2]
(same as v.z
)
- Vectors can represent any collection of data
- positions
- colors
- vector-valued data (e.g., velocity, direction, etc.)
- Vector components can be swizzled
- repeat component values
v.xxxx
- reorder components
v.zyx