| 0.9.9 API documenation

Functions
GLM_EXT_matrix_projection
Stable extensions

## Functions

template<typename T , qualifier Q, typename U >
GLM_FUNC_DECL mat< 4, 4, T, Q > | pickMatrix (vec< 2, T, Q > const &center, vec< 2, T, Q > const &delta, vec< 4, U, Q > const &viewport)
template<typename T , typename U , qualifier Q>
GLM_FUNC_DECL vec< 3, T, Q > | project (vec< 3, T, Q > const &obj, mat< 4, 4, T, Q > const &model, mat< 4, 4, T, Q > const &proj, vec< 4, U, Q > const &viewport)
template<typename T , typename U , qualifier Q>
GLM_FUNC_DECL vec< 3, T, Q > | projectNO (vec< 3, T, Q > const &obj, mat< 4, 4, T, Q > const &model, mat< 4, 4, T, Q > const &proj, vec< 4, U, Q > const &viewport)
template<typename T , typename U , qualifier Q>
GLM_FUNC_DECL vec< 3, T, Q > | projectZO (vec< 3, T, Q > const &obj, mat< 4, 4, T, Q > const &model, mat< 4, 4, T, Q > const &proj, vec< 4, U, Q > const &viewport)
template<typename T , typename U , qualifier Q>
GLM_FUNC_DECL vec< 3, T, Q > | unProject (vec< 3, T, Q > const &win, mat< 4, 4, T, Q > const &model, mat< 4, 4, T, Q > const &proj, vec< 4, U, Q > const &viewport)
template<typename T , typename U , qualifier Q>
GLM_FUNC_DECL vec< 3, T, Q > | unProjectNO (vec< 3, T, Q > const &win, mat< 4, 4, T, Q > const &model, mat< 4, 4, T, Q > const &proj, vec< 4, U, Q > const &viewport)
template<typename T , typename U , qualifier Q>
GLM_FUNC_DECL vec< 3, T, Q > | unProjectZO (vec< 3, T, Q > const &win, mat< 4, 4, T, Q > const &model, mat< 4, 4, T, Q > const &proj, vec< 4, U, Q > const &viewport)

## Detailed Description

Functions that generate common projection 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_projection.hpp> to use the features of this extension.

See also
  GLM_EXT_matrix_transform
  GLM_EXT_matrix_clip_space

## Function Documentation

## ◆ pickMatrix()

GLM_FUNC_DECL mat<4, 4, T, Q> glm::pickMatrix | ( | vec< 2, T, Q > const & | center,
|  | vec< 2, T, Q > const & | delta,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Define a picking region.

Parameters

  center | Specify the center of a picking region in window coordinates.
  delta | Specify the width and height, respectively, of the picking region in window coordinates.
  viewport | Rendering viewport

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluPickMatrix man page

## ◆ project()

GLM_FUNC_DECL vec<3, T, Q> glm::project | ( | vec< 3, T, Q > const & | obj,
|  | mat< 4, 4, T, Q > const & | model,
|  | mat< 4, 4, T, Q > const & | proj,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near and far clip planes definition.

To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.

Parameters

  obj | Specify the object coordinates.
  model | Specifies the current modelview matrix
  proj | Specifies the current projection matrix
  viewport | Specifies the current viewport

Returns
  Return the computed window coordinates.

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluProject man page

## ◆ projectNO()

GLM_FUNC_DECL vec<3, T, Q> glm::projectNO | ( | vec< 3, T, Q > const & | obj,
|  | mat< 4, 4, T, Q > const & | model,
|  | mat< 4, 4, T, Q > const & | proj,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.

The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)

Parameters

  obj | Specify the object coordinates.
  model | Specifies the current modelview matrix
  proj | Specifies the current projection matrix
  viewport | Specifies the current viewport

Returns
  Return the computed window coordinates.

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluProject man page

## ◆ projectZO()

GLM_FUNC_DECL vec<3, T, Q> glm::projectZO | ( | vec< 3, T, Q > const & | obj,
|  | mat< 4, 4, T, Q > const & | model,
|  | mat< 4, 4, T, Q > const & | proj,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.

The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)

Parameters

  obj | Specify the object coordinates.
  model | Specifies the current modelview matrix
  proj | Specifies the current projection matrix
  viewport | Specifies the current viewport

Returns
  Return the computed window coordinates.

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluProject man page

## ◆ unProject()

GLM_FUNC_DECL vec<3, T, Q> glm::unProject | ( | vec< 3, T, Q > const & | win,
|  | mat< 4, 4, T, Q > const & | model,
|  | mat< 4, 4, T, Q > const & | proj,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near and far clip planes definition.

To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.

Parameters

  win | Specify the window coordinates to be mapped.
  model | Specifies the modelview matrix
  proj | Specifies the projection matrix
  viewport | Specifies the viewport

Returns
  Returns the computed object coordinates.

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluUnProject man page

## ◆ unProjectNO()

GLM_FUNC_DECL vec<3, T, Q> glm::unProjectNO | ( | vec< 3, T, Q > const & | win,
|  | mat< 4, 4, T, Q > const & | model,
|  | mat< 4, 4, T, Q > const & | proj,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.

The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)

Parameters

  win | Specify the window coordinates to be mapped.
  model | Specifies the modelview matrix
  proj | Specifies the projection matrix
  viewport | Specifies the viewport

Returns
  Returns the computed object coordinates.

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluUnProject man page

## ◆ unProjectZO()

GLM_FUNC_DECL vec<3, T, Q> glm::unProjectZO | ( | vec< 3, T, Q > const & | win,
|  | mat< 4, 4, T, Q > const & | model,
|  | mat< 4, 4, T, Q > const & | proj,
|  | vec< 4, U, Q > const & | viewport
| ) |  |

Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.

The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)

Parameters

  win | Specify the window coordinates to be mapped.
  model | Specifies the modelview matrix
  proj | Specifies the projection matrix
  viewport | Specifies the viewport

Returns
  Returns the computed object coordinates.

Template Parameters

  T | Native type used for the computation. Currently supported: half (not recommended), float or double.
  U | Currently supported: Floating-point types and integer types.

See also
  gluUnProject man page