GLM_GTC_matrix_transform

Header: <glm/gtc/matrix_transform.hpp>

In this page, tmat4x4 stands for mat<4, 4, T, Q>, tvec3 stands for vec<3, T, Q> and tvec2 stands for vec<2, T, Q>.

Some notes on the convention

Coordinate system

Some functions use right handed coordinates by default. Define GLM_FORCE_LEFT_HANDED before including GLM to use left handed coordinate system by default.

Functions that are affected by this setting are:

Clip control

Some functions use the clip space \([-1,1]\) by default (the near clip plane is \(z=-1\)). Define GLM_FORCE_DEPTH_ZERO_TO_ONE to use \([0,1]\) clip space by default (the near clip plane is \(z=0\)).

Functions that are affected by this setting are:

The _NO and _ZO variants of functions have the relation that \[ \mathit{foo}\mathtt{\_ZO}(\mathit{args}) =\begin{pmatrix}1&&&\\&1&&\\&&1/2&1/2\\&&&1\end{pmatrix} \mathit{foo}\mathtt{\_NO}(\mathit{args}). \]

Rotation, scaling, and translation

Viewing Transformation (from world coordinates to view coordinates)

lookAt

Projection (from view coordinates to clip coordinates)

frustum

frustum(T left, T right, T bottom, T top, T near, T far) -> mat<4, 4, T, defaultp>

ortho (2-dim)

ortho (3-dim)

ortho(T left, T right, T bottom, T top, T zNear, T zFar) -> mat<4, 4, T, defaultp>

perspective

perspective(T fovy, T aspect, T near, T far) -> mat<4, 4, T, defaultp>

perspectiveFov

perspectiveFov(T fovy, T width, T height, T near, T far) -> mat<4, 4, T, defaultp>

infinitePerspective

infinitePerspective(T fovy, T aspect, T near) -> mat<4, 4, T, defaultp>

Miscellaneous functions

pickMatrix

project

unProject