talira

OpenGL Mathematics (GLM)

Header-only C++ mathematics library for graphics, modelled on GLSL

open sourceMIT OR The Happy Bunny License (Modified MIT License)free

OpenGL Mathematics (GLM) is a header-only C++ mathematics library for graphics software, built on the OpenGL Shading Language (GLSL) specifications: its vector and matrix types and functions use GLSL's names and behaviour, so anyone who knows GLSL can use it in C++. Extensions add matrix transformations, quaternions, data packing, random numbers and noise. It works with OpenGL and alongside other libraries, and suits software rendering, image processing and physics simulations. It needs a C++17 compiler (the 1.0 branch serves older ones) and has no dependencies.

Problems it solves

  • vector and matrix maths for my OpenGL renderer in C++
  • build a camera's view and projection matrices in C++
  • use the same maths types in my C++ code as in my GLSL shaders
  • a small header-only maths library for a raytracer

Features

  • GLSL-style vector and matrix types and functions in C++
  • header-only, with no dependencies
  • extensions for matrix transformations (translate, rotate, perspective) and quaternions
  • data packing, random numbers and noise
  • GCC, Clang, Visual C++ and experimental CUDA support

Limitations

  • Needs a C++17 compiler; older compilers need the 1.0 branch.1

Alternatives

The same job

These do what OpenGL Mathematics (GLM) does.

  1. Eigen C++ template library for linear algebra: matrices, vectors and solvers

Compare OpenGL Mathematics (GLM) with the top 3