Types

Vector types

Header: <glm/glm.hpp>

Base type 2-dim 3-dim 4-dim
float vec2 vec3 vec4
double dvec2 dvec3 dvec4
int ivec2 ivec3 ivec4
unsigned int uvec2 uvec3 uvec4
bool bvec2 bvec3 bvec4

Matrix types

Header: <glm/glm.hpp>

Base type 2-dim 3-dim 4-dim
float mat2 mat3 mat4
double dmat2 dmat3 dmat4
Base type 2x2 2x3 2x4
float mat2x2 mat2x3 mat2x4
double dmat2x2 dmat2x3 dmat2x4
Base type 3x2 3x3 3x4
float mat3x2 mat3x3 mat3x4
double dmat3x2 dmat3x3 dmat3x4
Base type 4x2 4x3 4x4
float mat4x2 mat4x3 mat4x4
double dmat4x2 dmat4x3 dmat4x4

GLM matrix types are column-major; i.e. a value of type mat4x4 represents a matrix \[\begin{pmatrix} \mathrm{a[0][0]} & \mathrm{a[1][0]} & \mathrm{a[2][0]} & \mathrm{a[3][0]} \\ \mathrm{a[0][1]} & \mathrm{a[1][1]} & \mathrm{a[2][1]} & \mathrm{a[3][1]} \\ \mathrm{a[0][2]} & \mathrm{a[1][2]} & \mathrm{a[2][2]} & \mathrm{a[3][2]} \\ \mathrm{a[0][3]} & \mathrm{a[1][3]} & \mathrm{a[2][3]} & \mathrm{a[3][3]} \end{pmatrix}\] and a value of type mat2x3 represents a matrix \[\begin{pmatrix} \mathrm{a[0][0]} & \mathrm{a[1][0]} \\ \mathrm{a[0][1]} & \mathrm{a[1][1]} \\ \mathrm{a[0][2]} & \mathrm{a[1][2]} \end{pmatrix}.\]

Stable extension: vec1

Header: <glm/ext/vec1.hpp>

Base type 1-dim
float vec1
double dvec1
int ivec1
unsigned int uvec1
bool bvec1