09/01/2012 GLM 0.9.3.0 released

GLM 0.9.3.0 is finally released. Since the branch 0.9.2, the test bench and the Doxygen API documentation has been expended significantly leading to an even more reliable implementation and hopefully an even smoother development experience.

For the feature set, the GLSL noise functions are added, based on the implementation of webgl-noise. Some users might prefer the promoted GLM_GTC_noise extension also based on webgl-noise but with a different interface and three noise methods: Perlin noise, periodic noise and simplex noise.

2D simplex noise with GLM_GTC_noise
2D simplex noise with GLM_GTC_noise

Additionally, the random number generation functions (GLM_GTC_random) which provides various interesting distributions as illustrated below. Also reaching GLM tool box, the new experimental extension GLM_GTX_constants provides a set of constants.

Spherical random distribution with GLM_GTC_random
Spherical random distribution with GLM_GTC_random

Finally, swizzle operators are a challenging task to implement but thanks to the effort of many contributors, GLM 0.9.3.0 provides something interesting, but admittably not perfect. The new implementation is a great improvement considering the incompatibilities with some external libraries in GLM 0.9.2.7. GLM 0.9.3 provides two implemetanations, one for C++ 98 compilers and one for C++ 11 compilers providing an implemetnation closer to what GLSL does. Indeed the C++ 98 implementation is compatible with C++ 11 compilers.

Implementation for C++ 98 compilers:
  • // To declare before including glm.hpp, to use the swizzle operators
  • #define GLM_SWIZZLE
  • #include <glm/glm.hpp>
  • void example_cpp98()
  • {
  • glm::vec4 a = glm::vec4(2, 0, 0, 0);
  • glm::vec4 b = glm::vec4(0, 2, 0, 0);
  • glm::vec3 c = vec4((a.zyx() + b.xyz()).xyz() * 0.5f, 1.0f);
  • glm::vec2 d = glm::normalize(glm::vec2(c.yz()));
  • a.xyzw() = d.xyxy();
  • }
Implementation for C++ 11 compilers:
  • // To declare before including glm.hpp, to use the swizzle operators
  • #define GLM_SWIZZLE
  • #include <glm/glm.hpp>
  • void example_cpp11()
  • {
  • glm::vec4 a = glm::vec4(2, 0, 0, 0);
  • glm::vec4 b = glm::vec4(0, 2, 0, 0);
  • glm::vec4 c = glm::vec4((a.zyx() + b.xyz()).xyz * 0.5f, 1.0f);
  • // Before being pasted to a function, a swizzle operator needs to be cast into
  • // a vector either explicitly or with the operator ()
  • glm::vec2 d = glm::normalize(glm::vec2(c.yz));
  • // glm::vec2 d = glm::normalize(c.yz()); // Equivalent code
  • a.xyzw = d.xyxy;
  • }
OpenGL Samples Pack 4.2.2.1 released >
< December 2011 OpenGL drivers status
Copyright Christophe Riccio 2002-2014 all rights reserved
Designed for Chrome 9, Firefox 4, Opera 11 and Safari 5