0.9.8: GLM_GTC_integer

| 0.9.8

- Main Page
- Modules
- Files

Functions
GLM_GTC_integer
GTC Extensions (Stable)

## Functions
template<typename T , precision P, template< typename, precision > class vecType>
GLM_FUNC_DECL vecType< int, P > | iround (vecType< T, P > const &x)
template<typename genIUType >
GLM_FUNC_DECL genIUType | log2 (genIUType x)
template<typename genIUType >
GLM_FUNC_DECL genIUType | mod (genIUType x, genIUType y)
template<typename T , precision P, template< typename, precision > class vecType>
GLM_FUNC_DECL vecType< T, P > | mod (vecType< T, P > const &x, T y)
template<typename T , precision P, template< typename, precision > class vecType>
GLM_FUNC_DECL vecType< T, P > | mod (vecType< T, P > const &x, vecType< T, P > const &y)
template<typename T , precision P, template< typename, precision > class vecType>
GLM_FUNC_DECL vecType< uint, P > | uround (vecType< T, P > const &x)

## Detailed Description

Allow to perform bit operations on integer values.

<glm/gtc/integer.hpp> need to be included to use these functionalities.

## Function Documentation

GLM_FUNC_DECL vecType<int, P> glm::iround | ( | vecType< T, P > const & | x | ) |

Returns a value equal to the nearest integer to x.

The fraction 0.5 will round in a direction chosen by the implementation, presumably the direction that is fastest.

Parameters

  x | The values of the argument must be greater or equal to zero.

Template Parameters

  T | floating point scalar types.
  vecType | vector types.

See also
  GLSL round man page
  GLM_GTC_integer

GLM_FUNC_DECL genIUType glm::log2 | ( | genIUType | x | ) |

Returns the log2 of x for integer values.

Can be reliably using to compute mipmap count from the texture size.

See also
  GLM_GTC_integer

GLM_FUNC_DECL genIUType glm::mod | ( | genIUType | x,
|  | genIUType | y
| ) |  |

Modulus.

Returns x % y for each component in x using the floating point value y.

Template Parameters

  genIUType | Integer-point scalar or vector types.

See also
  GLM_GTC_integer
  GLSL mod man page
  GLSL 4.20.8 specification, section 8.3 Common Functions

GLM_FUNC_DECL vecType< T, P > mod | ( | vecType< T, P > const & | x,
|  | T | y
| ) |  |

Modulus.

Returns x % y for each component in x using the floating point value y.

Template Parameters

  T | Integer scalar types.
  vecType | vector types.

See also
  GLM_GTC_integer
  GLSL mod man page
  GLSL 4.20.8 specification, section 8.3 Common Functions

GLM_FUNC_DECL vecType< T, P > mod | ( | vecType< T, P > const & | x,
|  | vecType< T, P > const & | y
| ) |  |

Modulus.

Returns x % y for each component in x using the floating point value y.

Template Parameters

  T | Integer scalar types.
  vecType | vector types.

See also
  GLM_GTC_integer
  GLSL mod man page
  GLSL 4.20.8 specification, section 8.3 Common Functions

GLM_FUNC_DECL vecType<uint, P> glm::uround | ( | vecType< T, P > const & | x | ) |

Returns a value equal to the nearest integer to x.

The fraction 0.5 will round in a direction chosen by the implementation, presumably the direction that is fastest.

Parameters

  x | The values of the argument must be greater or equal to zero.

Template Parameters

  T | floating point scalar types.
  vecType | vector types.

See also
  GLSL round man page
  GLM_GTC_integer