GLM does not depend on external libraries or headers such as `<GL/gl.h>`, [`<GL/glcorearb.h>`](http://www.opengl.org/registry/api/GL/glcorearb.h), `<GLES3/gl3.h>`, `<GL/glu.h>`, or `<windows.h>`.
GLM does not depend on external libraries or headers such as `<GL/gl.h>`, [`<GL/glcorearb.h>`](http://www.opengl.org/registry/api/GL/glcorearb.h), `<GLES3/gl3.h>`, `<GL/glu.h>`, or `<windows.h>`.
Shader languages like GLSL often feature so-called swizzle expressions, which may be used to freely select and arrange a vector's components. For example, `variable.x`, `variable.xzy` and `variable.zxyy` respectively form a scalar, a 3D vector and a 4D vector. The result of a swizzle expression in GLSL can be either an R-value or an L-value. Swizzle expressions can be written with characters from exactly one of `xyzw` (usually for positions), `rgba` (usually for colors), and `stpq` (usually for texture coordinates).
Shader languages like GLSL often feature so-called swizzle expressions, which may be used to freely select and arrange a vector's components. For example, `variable.x`, `variable.xzy` and `variable.zxyy` respectively form a scalar, a 3D vector and a 4D vector. The result of a swizzle expression in GLSL can be either an R-value or an L-value. Swizzle expressions can be written with characters from exactly one of `xyzw` (usually for positions), `rgba` (usually for colors), and `stpq` (usually for texture coordinates).
@ -263,7 +265,7 @@ GLM optionally supports some of this functionality via the methods described in
*Note that enabling swizzle expressions will massively increase the size of your binaries and the time it takes to compile them!*
*Note that enabling swizzle expressions will massively increase the size of your binaries and the time it takes to compile them!*
C++ does not provide a way to implement GLSL default precision selection (as defined in GLSL 4.10 specification section 4.5.3) with GLSL-like syntax.
```cpp
precision mediump int;
precision highp float;
```
To use the default precision functionality, GLM provides some defines that need to added before any include of `glm.hpp`:
```cpp
TODO
#define GLM_PRECISION_MEDIUMP_INT
#define GLM_PRECISION_HIGHP_FLOAT
#include<glm/glm.hpp>
```
Available defines for floating point types (glm::vec\*, glm::mat\*):
### <aname="section2_4"></a> 2.4. GLM\_FORCE\_MESSAGES: Compile-time message system
* GLM\_PRECISION\_LOWP\_FLOAT: Low precision
* GLM\_PRECISION\_MEDIUMP\_FLOAT: Medium precision
* GLM\_PRECISION\_HIGHP\_FLOAT: High precision (default)
Available defines for floating point types (glm::dvec\*, glm::dmat\*):
* GLM\_PRECISION\_LOWP\_DOUBLE: Low precision
* GLM\_PRECISION\_MEDIUMP\_DOUBLE: Medium precision
* GLM\_PRECISION\_HIGHP\_DOUBLE: High precision (default)
Available defines for signed integer types (glm::ivec\*):
* GLM\_PRECISION\_LOWP\_INT: Low precision
* GLM\_PRECISION\_MEDIUMP\_INT: Medium precision
* GLM\_PRECISION\_HIGHP\_INT: High precision (default)
Available defines for unsigned integer types (glm::uvec\*):
* GLM\_PRECISION\_LOWP\_UINT: Low precision
* GLM\_PRECISION\_MEDIUMP\_UINT: Medium precision
* GLM\_PRECISION\_HIGHP\_UINT: High precision (default)
### <aname="section3_2"></a> 3.2. GLM\_FORCE\_MESSAGES: Compile-time message system
GLM includes a notification system which can display some information at build time:
GLM includes a notification system which can display some information at build time:
@ -413,7 +375,7 @@ only once per project build.
#include<glm/glm.hpp>
#include<glm/glm.hpp>
```
```
### <aname="section3_3"></a> 3.3. GLM\_FORCE\_CXX**: C++ language detection
### <aname="section2_5"></a> 2.5. GLM\_FORCE\_CXX**: C++ language detection
GLM will automatically take advantage of compilers’ language extensions when enabled. To increase cross platform compatibility and to avoid compiler extensions, a programmer can define GLM\_FORCE\_CXX98 before
GLM will automatically take advantage of compilers’ language extensions when enabled. To increase cross platform compatibility and to avoid compiler extensions, a programmer can define GLM\_FORCE\_CXX98 before
any inclusion of <glm/glm.hpp> to restrict the language feature set C++98:
any inclusion of <glm/glm.hpp> to restrict the language feature set C++98:
C++ does not provide a way to implement GLSL default precision selection (as defined in GLSL 4.10 specification section 4.5.3) with GLSL-like syntax.
```cpp
precision mediump int;
precision highp float;
```
To use the default precision functionality, GLM provides some defines that need to added before any include of `glm.hpp`:
```cpp
#define GLM_PRECISION_MEDIUMP_INT
#define GLM_PRECISION_HIGHP_FLOAT
#include<glm/glm.hpp>
```
Available defines for floating point types (glm::vec\*, glm::mat\*):
* GLM\_PRECISION\_LOWP\_FLOAT: Low precision
* GLM\_PRECISION\_MEDIUMP\_FLOAT: Medium precision
* GLM\_PRECISION\_HIGHP\_FLOAT: High precision (default)
Available defines for floating point types (glm::dvec\*, glm::dmat\*):
* GLM\_PRECISION\_LOWP\_DOUBLE: Low precision
* GLM\_PRECISION\_MEDIUMP\_DOUBLE: Medium precision
* GLM\_PRECISION\_HIGHP\_DOUBLE: High precision (default)
Available defines for signed integer types (glm::ivec\*):
* GLM\_PRECISION\_LOWP\_INT: Low precision
* GLM\_PRECISION\_MEDIUMP\_INT: Medium precision
* GLM\_PRECISION\_HIGHP\_INT: High precision (default)
Available defines for unsigned integer types (glm::uvec\*):
* GLM\_PRECISION\_LOWP\_UINT: Low precision
* GLM\_PRECISION\_MEDIUMP\_UINT: Medium precision
* GLM\_PRECISION\_HIGHP\_UINT: High precision (default)
### <aname="section2_10"></a> 2.10. GLM\_FORCE\_INLINE: Force inline
To push further the software performance, a programmer can define GLM\_FORCE\_INLINE before any inclusion of <glm/glm.hpp> to force the compiler to inline GLM code.
To push further the software performance, a programmer can define GLM\_FORCE\_INLINE before any inclusion of <glm/glm.hpp> to force the compiler to inline GLM code.
@ -472,7 +483,7 @@ To push further the software performance, a programmer can define GLM\_FORCE\_IN
#include<glm/glm.hpp>
#include<glm/glm.hpp>
```
```
### <aname="section3_6"></a> 3.6. GLM\_FORCE\_SIZE\_T\_LENGTH: Vector and matrix static size
### <aname="section2_11"></a> 3.6. GLM\_FORCE\_SIZE\_T\_LENGTH: Vector and matrix static size
GLSL supports the member function .length() for all vector and matrix types.
GLSL supports the member function .length() for all vector and matrix types.
However, defining GLM\_FORCE\_UNRESTRICTED\_GENTYPE is not compatible with GLM\_FORCE\_SWIZZLE and will generate a compilation error if both are defined at the same time.
However, defining GLM\_FORCE\_UNRESTRICTED\_GENTYPE is not compatible with GLM\_FORCE\_SWIZZLE and will generate a compilation error if both are defined at the same time.
### <aname="section3_9"></a> 3.9. GLM\_FORCE\_SINGLE\_ONLY: Removed explicit 64-bits floating point types
### <aname="section2_14"></a> 2.14. GLM\_FORCE\_SINGLE\_ONLY: Removed explicit 64-bits floating point types
Some platforms (Dreamcast) doesn't support double precision floating point values. To compile on such platforms, GCC has the --m4-single-only build argument. When defining GLM\_FORCE\_SINGLE\_ONLY before including GLM headers, GLM releases the requirement of double precision floating point values support. Effectivement, all the float64 types are no longer defined and double behaves like float.
Some platforms (Dreamcast) doesn't support double precision floating point values. To compile on such platforms, GCC has the --m4-single-only build argument. When defining GLM\_FORCE\_SINGLE\_ONLY before including GLM headers, GLM releases the requirement of double precision floating point values support. Effectivement, all the float64 types are no longer defined and double behaves like float.
### <aname="section2_15"></a> 2.15. GLM\_FORCE\_DEFAULT\_ALIGNED_GENTYPES: Force GLM to use aligned types by default
TODO
### <aname="section2_16"></a> 2.16. GLM_\FORCE\_PLATFORM\_UNKNOWN: Force GLM to no detect the build platform
GLM extends the core GLSL feature set with extensions. These extensions include: quaternion, transformation, spline, matrix inverse, color spaces, etc.
GLM extends the core GLSL feature set with extensions. These extensions include: quaternion, transformation, spline, matrix inverse, color spaces, etc.