| 0.9.9 API documenation

Functions
GLM_EXT_matrix_transform
Stable extensions

## Functions
template<typename genType >
GLM_FUNC_DECL GLM_CONSTEXPR genType | identity ()
template<typename T , qualifier Q>
GLM_FUNC_DECL mat< 4, 4, T, Q > | lookAt (vec< 3, T, Q > const &eye, vec< 3, T, Q > const &center, vec< 3, T, Q > const &up)
template<typename T , qualifier Q>
GLM_FUNC_DECL mat< 4, 4, T, Q > | lookAtLH (vec< 3, T, Q > const &eye, vec< 3, T, Q > const &center, vec< 3, T, Q > const &up)
template<typename T , qualifier Q>
GLM_FUNC_DECL mat< 4, 4, T, Q > | lookAtRH (vec< 3, T, Q > const &eye, vec< 3, T, Q > const &center, vec< 3, T, Q > const &up)
template<typename T , qualifier Q>
GLM_FUNC_DECL mat< 4, 4, T, Q > | rotate (mat< 4, 4, T, Q > const &m, T angle, vec< 3, T, Q > const &axis)
template<typename T , qualifier Q>
GLM_FUNC_DECL mat< 4, 4, T, Q > | scale (mat< 4, 4, T, Q > const &m, vec< 3, T, Q > const &v)
template<typename T , qualifier Q>
GLM_FUNC_DECL mat< 4, 4, T, Q > | translate (mat< 4, 4, T, Q > const &m, vec< 3, T, Q > const &v)

## Detailed Description

Defines functions that generate common transformation matrices.

The matrices generated by this extension use standard OpenGL fixed-function conventions. For example, the lookAt function generates a transform from world space into the specific eye space that the projective matrix functions (perspective, ortho, etc) are designed to expect. The OpenGL compatibility specifications defines the particular layout of this eye space.

Include <glm/ext/matrix_transform.hpp> to use the features of this extension.

See also
  GLM_EXT_matrix_projection
  GLM_EXT_matrix_clip_space

## Function Documentation

## ◆ lookAt()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::lookAt | ( | vec< 3, T, Q > const & | eye,
|  | vec< 3, T, Q > const & | center,
|  | vec< 3, T, Q > const & | up
| ) |  |

Build a look at view matrix based on the default handedness.

Parameters

  eye | Position of the camera
  center | Position where the camera is looking at
  up | Normalized up vector, how the camera is oriented. Typically (0, 0, 1)

Template Parameters

  T | A floating-point scalar type
  Q | A value from qualifier enum

See also
  - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
  gluLookAt man page

## ◆ lookAtLH()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::lookAtLH | ( | vec< 3, T, Q > const & | eye,
|  | vec< 3, T, Q > const & | center,
|  | vec< 3, T, Q > const & | up
| ) |  |

Build a left handed look at view matrix.

Parameters

  eye | Position of the camera
  center | Position where the camera is looking at
  up | Normalized up vector, how the camera is oriented. Typically (0, 0, 1)

Template Parameters

  T | A floating-point scalar type
  Q | A value from qualifier enum

See also
  - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)

## ◆ lookAtRH()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::lookAtRH | ( | vec< 3, T, Q > const & | eye,
|  | vec< 3, T, Q > const & | center,
|  | vec< 3, T, Q > const & | up
| ) |  |

Build a right handed look at view matrix.

Parameters

  eye | Position of the camera
  center | Position where the camera is looking at
  up | Normalized up vector, how the camera is oriented. Typically (0, 0, 1)

Template Parameters

  T | A floating-point scalar type
  Q | A value from qualifier enum

See also
  - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)

## ◆ rotate()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::rotate | ( | mat< 4, 4, T, Q > const & | m,
|  | T | angle,
|  | vec< 3, T, Q > const & | axis
| ) |  |

Builds a rotation 4 * 4 matrix created from an axis vector and an angle.

Parameters

  m | Input matrix multiplied by this rotation matrix.
  angle | Rotation angle expressed in radians.
  axis | Rotation axis, recommended to be normalized.

Template Parameters

  T | A floating-point scalar type
  Q | A value from qualifier enum

See also
  - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)
  - rotate(T angle, vec<3, T, Q> const& v)
  glRotate man page

## ◆ scale()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::scale | ( | mat< 4, 4, T, Q > const & | m,
|  | vec< 3, T, Q > const & | v
| ) |  |

Builds a scale 4 * 4 matrix created from 3 scalars.

Parameters

  m | Input matrix multiplied by this scale matrix.
  v | Ratio of scaling for each axis.

Template Parameters

  T | A floating-point scalar type
  Q | A value from qualifier enum

See also
  - scale(mat<4, 4, T, Q> const& m, T x, T y, T z)
  - scale(vec<3, T, Q> const& v)
  glScale man page

## ◆ translate()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::translate | ( | mat< 4, 4, T, Q > const & | m,
|  | vec< 3, T, Q > const & | v
| ) |  |

Builds a translation 4 * 4 matrix created from a vector of 3 components.

Parameters

  m | Input matrix multiplied by this translation matrix.
  v | Coordinates of a translation vector.

Template Parameters

  T | A floating-point scalar type
  Q | A value from qualifier enum

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
...
glm::mat4 m = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f));
// m[0][0] == 1.0f, m[0][1] == 0.0f, m[0][2] == 0.0f, m[0][3] == 0.0f
// m[1][0] == 0.0f, m[1][1] == 1.0f, m[1][2] == 0.0f, m[1][3] == 0.0f
// m[2][0] == 0.0f, m[2][1] == 0.0f, m[2][2] == 1.0f, m[2][3] == 0.0f
// m[3][0] == 1.0f, m[3][1] == 1.0f, m[3][2] == 1.0f, m[3][3] == 1.0f

See also
  - translate(mat<4, 4, T, Q> const& m, T x, T y, T z)
  - translate(vec<3, T, Q> const& v)
  glTranslate man page