+ [2.3. GLM\_FORCE\_XYZW\_ONLY: Only exposes x, y, z and w components](#section2_3)
@ -98,7 +98,7 @@
### The Happy Bunny License (Modified MIT License)
Copyright (c) 2005 - 2017 G-Truc Creation
Copyright (c) 2005 - G-Truc Creation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
@ -126,7 +126,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
### The MIT License
Copyright (c) 2005 - 2017 G-Truc Creation
Copyright (c) 2005 - G-Truc Creation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
@ -152,63 +152,92 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
## <aname="section1"></a> 1. Getting started
### <aname="section1_1"></a> 1.1. Setup
### <aname="section1_1"></a> 1.1. Using global headers
GLM is a header-only library, and thus does not need to be compiled. We can use GLM's implementation of GLSL's mathematics functionality by including the `<glm/glm.hpp>` header. The library can also be installed with CMake, though the details of doing so will differ depending on the target build system.
Features can also be included individually to shorten compilation times.
GLM is a header-only library, and thus does not need to be compiled. We can use GLM's implementation of GLSL's mathematics functionality by including the `<glm/glm.hpp>` header:
```cpp
#include<glm/vec2.hpp> // vec2, bvec2, dvec2, ivec2 and uvec2
#include<glm/vec3.hpp> // vec3, bvec3, dvec3, ivec3 and uvec3
#include<glm/vec4.hpp> // vec4, bvec4, dvec4, ivec4 and uvec4
#include<glm/mat2x2.hpp> // mat2, dmat2
#include<glm/mat2x3.hpp> // mat2x3, dmat2x3
#include<glm/mat2x4.hpp> // mat2x4, dmat2x4
#include<glm/mat3x2.hpp> // mat3x2, dmat3x2
#include<glm/mat3x3.hpp> // mat3, dmat3
#include<glm/mat3x4.hpp> // mat3x4, dmat2
#include<glm/mat4x2.hpp> // mat4x2, dmat4x2
#include<glm/mat4x3.hpp> // mat4x3, dmat4x3
#include<glm/mat4x4.hpp> // mat4, dmat4
#include<glm/common.hpp> // all the GLSL common functions
#include<glm/exponential.hpp> // all the GLSL exponential functions
#include<glm/geometry.hpp> // all the GLSL geometry functions
#include<glm/integer.hpp> // all the GLSL integer functions
#include<glm/matrix.hpp> // all the GLSL matrix functions
#include<glm/packing.hpp> // all the GLSL packing functions
#include<glm/trigonometric.hpp> // all the GLSL trigonometric functions
#include<glm/vector_relational.hpp> // all the GLSL vector relational functions
GLM uses C++ templates heavily, and may significantly increase compilation times for projects that use it. Hence, source files should only include the headers they actually use.
Precompiled headers will also be helpful, though are not covered by this manual.
### <aname="section1_2"></a> 1.2. Using separated headers
### <aname="section1_3"></a> 1.3. Example usage
GLM relies on C++ templates heavily, and may significantly increase compilation times for projects that use it. Hence, user projects could only include the features they actually use:
```cpp
#include<glm/vec2.hpp> // vec2, bvec2, dvec2, ivec2 and uvec2
#include<glm/vec3.hpp> // vec3, bvec3, dvec3, ivec3 and uvec3
#include<glm/vec4.hpp> // vec4, bvec4, dvec4, ivec4 and uvec4
#include<glm/mat2x2.hpp> // mat2, dmat2
#include<glm/mat2x3.hpp> // mat2x3, dmat2x3
#include<glm/mat2x4.hpp> // mat2x4, dmat2x4
#include<glm/mat3x2.hpp> // mat3x2, dmat3x2
#include<glm/mat3x3.hpp> // mat3, dmat3
#include<glm/mat3x4.hpp> // mat3x4, dmat2
#include<glm/mat4x2.hpp> // mat4x2, dmat4x2
#include<glm/mat4x3.hpp> // mat4x3, dmat4x3
#include<glm/mat4x4.hpp> // mat4, dmat4
#include<glm/common.hpp> // all the GLSL common functions: abs, min, mix, isnan, fma, etc.
#include<glm/exponential.hpp> // all the GLSL exponential functions: pow, log, exp2, sqrt, etc.
#include<glm/geometry.hpp> // all the GLSL geometry functions: dot, cross, reflect, etc.
#include<glm/integer.hpp> // all the GLSL integer functions: findMSB, bitfieldExtract, etc.
#include<glm/matrix.hpp> // all the GLSL matrix functions: transpose, inverse, etc.
#include<glm/packing.hpp> // all the GLSL packing functions: packUnorm4x8, unpackHalf2x16, etc.
#include<glm/trigonometric.hpp> // all the GLSL trigonometric functions: radians, cos, asin, etc.
#include<glm/vector_relational.hpp> // all the GLSL vector relational functions: equal, less, etc.
```
Using GLM through headers including features separated following the structure of GLSL specifications: