Magnum::GlmIntegration namespace

Integration with OpenGL Mathematics (GLM)

Conversion of math types from and to the GLM library, debug output.


This library depends on the GLM library and is built if WITH_GLM is enabled when building Magnum Integration. To use this library with CMake, put FindMagnumIntegration.cmake and FindGLM.cmake into your modules/ directory, request the Glm component of the MagnumIntegration package and link to the MagnumIntegration::Glm target:

find_package(MagnumIntegration REQUIRED Glm)

# ...
target_link_libraries(your-app PRIVATE MagnumIntegration::Glm)

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-integration repository and do the following before calling find_package(). Using GLM itself as a CMake subproject isn't tested at the moment, so you need to provide it as a system dependency and point CMAKE_PREFIX_PATH to its installation dir if necessary.

add_subdirectory(magnum-integration EXCLUDE_FROM_ALL)

Type conversion

The library provides built-in conversion between GLM's types and Magnum's own types. For example, a glm::vec3 can be easily cast to Magnum's equivalent Vector3:

#include <Magnum/GlmIntegration/Integration.h>

glm::vec3 a{1.0f, 2.0f, 3.0f};
Vector3 b(a);

auto c = Matrix4::rotation(35.0_degf, Vector3(a));

The integration routines are provided in Magnum/GlmIntegration/Integration.h, Magnum/GlmIntegration/GtcIntegration.h and Magnum/GlmIntegration/GtxIntegration.h headers, see their documentation for more information. See also Downloading and building integration libraries and Integration library usage with CMake.