OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software based on the OpenGL Shading Language (GLSL) specification and released under the MIT license.
This library provides classes and functions designed and implemented following as strictly as possible the GLSL conventions and functionalities so that when a programmer knows GLSL, he knows GLM as well, making it really easy to use.
This project isn't limited to GLSL features. An extension system provides extended capabilities: matrix transformations, quaternions, half-based types, random number generation, procedural noise functions, etc.
GLM ensures interoperability with third party libraries, SDKs and OpenGL; replacing advantageously the deprecated matrix functions. It is a good candidate for software rendering (Raytracing / Rasterisation), image processing, physic simulations and any context that requires a simple and convenient mathematics library.

It is a platform independent library with no dependence to external libraries even OpenGL. GLM is written in C++98 but can take advantage of C++11 when available. It supports the following compilers:
Clang 2.6 and higher
CUDA 3.0 and higher
GCC 3.4 and higher
Intel C++ Composer XE 2013 and higher
LLVM 2.3 through GCC 4.2 front-end and higher
Visual C++ 2005 and higher
Any conform C++98 or C++11 compiler

For more information about GLM, please have a look at the manual and the API reference documentation.
Thanks for contributing to the project by submitting issues for bug reports and feature requests. Any feedback is welcome at

Install-Package GLMathematics -Version
dotnet add package GLMathematics --version
<PackageReference Include="GLMathematics" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GLMathematics --version
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GLMathematics,"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install GLMathematics as a Cake Addin
#addin nuget:?package=GLMathematics&version=

// Install GLMathematics as a Cake Tool
#tool nuget:?package=GLMathematics&version=
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Added right and left handed projection and clip control support #447 #415 #119
Added compNormalize and compScale functions to GTX_component_wise
Added packF3x9_E1x5 and unpackF3x9_E1x5 to GTC_packing for RGB9E5 #416
Added (un)packHalf to GTC_packing
Added (un)packUnorm and (un)packSnorm to GTC_packing
Added 16bit pack and unpack to GTC_packing
Added 8bit pack and unpack to GTC_packing
Added missing bvec* && and || operators
Added iround and uround to GTC_integer, fast round on positive values
Added raw SIMD API
Added 'aligned' qualifiers
Added GTC_type_aligned with aligned vec types
Added GTC_functions extension
Added quaternion version of isnan and isinf #521
Added lowestBitValue to GTX_bit #536
Added GLM_FORCE_UNRESTRICTED_GENTYPE allowing non basic genType #543

Improved SIMD and swizzle operators interactions with GCC and Clang #474
Improved GTC_random linearRand documentation
Improved GTC_reciprocal documentation
Improved GLM_FORCE_EXPLICIT_CTOR coverage #481
Improved OpenMP support detection for Clang, GCC, ICC and VC
Improved GTX_wrap for SIMD friendliness
Added constexpr for vec, mat, quat and dual_quat types #493
Added NEON instruction set detection
Added MIPS CPUs detection
Added PowerPC CPUs detection
Use Cuda built-in function for abs function implementation with Cuda compiler
No more warnings for use of long long
Added more information to build messages

Fixed GTX_extended_min_max filename typo #386
Fixed intersectRayTriangle to not do any unintentional backface culling
Fixed long long warnings when using C++98 on GCC and Clang #482
Fixed sign with signed integer function on non-x86 architecture
Fixed strict aliasing warnings #473
Fixed missing vec1 overload to length2 and distance2 functions #431
Fixed GLM test '/fp:fast' and '/Za' command-line options are incompatible
Fixed quaterion to mat3 cast function mat3_cast from GTC_quaternion #542
Fixed GLM_GTX_io for Cuda #547 #546

Removed GLM_FORCE_SIZE_FUNC define
Deprecated GLM_GTX_simd_vec4 extension
Deprecated GLM_GTX_simd_mat4 extension
Deprecated GLM_GTX_simd_quat extension
Deprecated GLM_SWIZZLE, use GLM_FORCE_SWIZZLE instead


This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated 5,774 1/8/2017