thebookofshaders/glossary/vec4
2017-12-17 20:54:25 +00:00
..
README.md Update vector glossary docs 2017-12-17 20:54:25 +00:00

Vec4

4 dimentional floating point vector

Declaration

vec4 aVec4 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 bVec4 = vec4(1.0);

vec4 cVec4 = vec4(aVec2, aFloat, aVec3);
vec4 dVec4 = vec4(aBvec2.x, aBvec2.y, aFloat, aBvec3.x);

Description

vec4 is a floating point vector with four components. It can be initialized by:

  • Providing a scalar value for each component.
  • Providing one scalar value. This value is used for all components.
  • Providing a combination of vectors and scalars. The respective values are used to initialize the components. The arguments of the constructor must have at least as many components as the vector that is initialized.

See Also

bool, int, float, bvec2, bvec3, bvec4, ivec2, ivec3, ivec4, vec2, vec3, vec4, mat2, mat3, mat4