Download GLM 0.9.3.0</a></div></div><br/><divclass="menu2"><ahref="./index.html">Front page</a></div><divclass="menu2"><ahref="./download.html">Downloads</a></div><divclass="menu2"><ahref="http://www.opengl.org/sdk/libs/GLM/">OpenGL SDK page</a></div><br/><divclass="menu2"><ahref="./glm.pdf">GLM Manual</a></div><divclass="menu2"><ahref="./api/index.html">GLM API</a></div><divclass="menu2"><ahref="./code.html">Code samples</a></div><divclass="menu2"><ahref="http://www.opengl.org/registry/doc/GLSLangSpec.4.10.6.clean.pdf">GLSL Specification</a></div><divclass="menu2"><ahref="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=postlist&Board=10&page=1">OpenGL.org Toolkits forum</a></div><br/><divclass="menu2"><ahref="https://sourceforge.net/apps/trac/ogl-math/newticket">Report a bug</a></div><divclass="menu2"><ahref="https://sourceforge.net/projects/ogl-math/">SourceForge page</a></div><divclass="menu2"><ahref="http://www.g-truc.net/project-0016.html#menu">G-Truc Creation page</a></div><divclass="menu2"><ahref="http://ogl-math.git.sourceforge.net/git/gitweb.cgi?p=ogl-math/ogl-math;a=summary">Browse Git repository</a></div><divclass="menu2"><ahref="http://ogl-math.git.sourceforge.net/git/gitweb.cgi?p=ogl-math/ogl-math;a=snapshot;h=HEAD;sf=tgz">Source snapshot</a></div><br/><br/><divclass="menu2"><ahref="http://www.g-truc.net"><imgclass="menu-img"src="./common/g-truc.png"alt="G-Truc"/></a></div><br/></td><tdclass="page"><divclass="title1"><imgsrc="./common/title.png"alt="OpenGL Mathematics"/></div><divclass="title3">GLSL + Optional features = OpenGL Mathematics (GLM)<br/>A C++ mathematics library for graphics programming<br/></div><br/><br/><div><divclass="title-date"></div><divclass="title4"></div><div><p>
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software
based on the <ahref="http://www.opengl.org/documentation/glsl/">OpenGL Shading Language (GLSL)</a> specification.
</p><p>
@ -32,4 +32,4 @@
Thanks for contributing to the project by <ahref="https://sourceforge.net/apps/trac/ogl-math/newticket">submitting tickets</a> for bug reports and feature requests. (SF.net account required).
Any feedback is welcome at glm@g-truc.net.
</p><divxmlns="http://www.w3.org/1999/xhtml"><spanclass="list">GLM is written in C++98 but can take advantage of C++11 when supported by the compiler. It is a platform independent library with no dependence and officially supports the following compilers:</span><ul><li><axmlns=""href="http://clang.llvm.org">Clang</a> 2.6 and higher</li><li><axmlns=""href="http://developer.nvidia.com/category/zone/cuda-zone">CUDA</a> 3.0 and higher
</li><li><axmlns=""href="http://gcc.gnu.org/">GCC</a> 3.4 and higher</li><li><axmlns=""href="http://llvm.org/">LLVM</a> 2.3 through GCC 4.2 front-end and higher</li><li><axmlns=""href="http://msdn.microsoft.com/en-us/visualc/default">Visual C++</a> 2005 and higher</li><li>Any conform C++98 or C++11 compiler</li></ul></div></div><divclass="news-separator">_________________</div><br/></div><divclass="email"><imgsrc="./common/email.png"alt="email not available as text"/></div><divclass="news-separator">_________________</div><br/><divclass="title3">Copyright Š 2005 - 2011<ahref="http://www.g-truc.net">G-Truc Creation</a></div></td></tr></table></body></html>
</li><li><axmlns=""href="http://gcc.gnu.org/">GCC</a> 3.4 and higher</li><li><axmlns=""href="http://llvm.org/">LLVM</a> 2.3 through GCC 4.2 front-end and higher</li><li><axmlns=""href="http://msdn.microsoft.com/en-us/visualc/default">Visual C++</a> 2005 and higher</li><li>Any conform C++98 or C++11 compiler</li></ul></div></div><divclass="news-separator">_________________</div><br/></div><divclass="email"><imgsrc="./common/email.png"alt="email not available as text"/></div><divclass="news-separator">_________________</div><br/><divclass="title3">Copyright Š 2005 - 2012<ahref="http://www.g-truc.net">G-Truc Creation</a></div></td></tr></table></body></html>
</div></div><divclass="news-separator">_________________</div><br/><divclass="email"><imgsrc="./common/email.png"alt="email not available as text"/></div><divclass="news-separator">_________________</div><br/><divclass="title3">Copyright Š 2005 - 2011<ahref="http://www.g-truc.net">G-Truc Creation</a></div></td></tr></table></body></html>
</div></div><divclass="news-separator">_________________</div><br/><divclass="email"><imgsrc="./common/email.png"alt="email not available as text"/></div><divclass="news-separator">_________________</div><br/><divclass="title3">Copyright Š 2005 - 2012<ahref="http://www.g-truc.net">G-Truc Creation</a></div></td></tr></table></body></html>
Download GLM 0.9.3.0</a></div></div><br/><divclass="menu2"><ahref="./index.html">Front page</a></div><divclass="menu2"><ahref="./download.html">Downloads</a></div><divclass="menu2"><ahref="http://www.opengl.org/sdk/libs/GLM/">OpenGL SDK page</a></div><br/><divclass="menu2"><ahref="./glm.pdf">GLM Manual</a></div><divclass="menu2"><ahref="./api/index.html">GLM API</a></div><divclass="menu2"><ahref="./code.html">Code samples</a></div><divclass="menu2"><ahref="http://www.opengl.org/registry/doc/GLSLangSpec.4.10.6.clean.pdf">GLSL Specification</a></div><divclass="menu2"><ahref="http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=postlist&Board=10&page=1">OpenGL.org Toolkits forum</a></div><br/><divclass="menu2"><ahref="https://sourceforge.net/apps/trac/ogl-math/newticket">Report a bug</a></div><divclass="menu2"><ahref="https://sourceforge.net/projects/ogl-math/">SourceForge page</a></div><divclass="menu2"><ahref="http://www.g-truc.net/project-0016.html#menu">G-Truc Creation page</a></div><divclass="menu2"><ahref="http://ogl-math.git.sourceforge.net/git/gitweb.cgi?p=ogl-math/ogl-math;a=summary">Browse Git repository</a></div><divclass="menu2"><ahref="http://ogl-math.git.sourceforge.net/git/gitweb.cgi?p=ogl-math/ogl-math;a=snapshot;h=HEAD;sf=tgz">Source snapshot</a></div><br/><br/><divclass="menu2"><ahref="http://www.g-truc.net"><imgclass="menu-img"src="./common/g-truc.png"alt="G-Truc"/></a></div><br/></td><tdclass="page"><divclass="title1"><imgsrc="./common/title.png"alt="OpenGL Mathematics"/></div><divclass="title3">GLSL + Optional features = OpenGL Mathematics (GLM)<br/>A C++ mathematics library for graphics programming<br/></div><br/><br/><p>
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics software
based on the <ahref="http://www.opengl.org/documentation/glsl/">OpenGL Shading Language (GLSL)</a> specification.
</p><p>
@ -34,10 +34,52 @@
<p>
Thanks for contributing to the project by <ahref="https://sourceforge.net/apps/trac/ogl-math/newticket">submitting tickets</a> for bug reports and feature requests. (SF.net account required).
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.
</p><p>
For the feature set, the GLSL noise functions are added, based on the implementation of <ahref="https://github.com/ashima/webgl-noise">webgl-noise</a>.
Some users might prefer the promoted GLM_GTC_noise extension also based on <ahref="https://github.com/ashima/webgl-noise">webgl-noise</a> but with a different interface and three noise methods: Perlin noise, periodic noise and simplex noise.
</p><divxmlns="http://www.w3.org/1999/xhtml"class="post-image-white"><ahref=""><imgsrc="./image/0075-1.jpg"alt="2D simplex noise with GLM_GTC_noise"/></a></div><divxmlns="http://www.w3.org/1999/xhtml"class="post-image-title">2D simplex noise with GLM_GTC_noise</div><p>
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.
</p><divxmlns="http://www.w3.org/1999/xhtml"class="post-image-white"><ahref=""><imgsrc="./image/0075-2.jpg"alt="Spherical random distribution with GLM_GTC_random"/></a></div><divxmlns="http://www.w3.org/1999/xhtml"class="post-image-title">Spherical random distribution with GLM_GTC_random</div><p>
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.
</p><spanxmlns="http://www.w3.org/1999/xhtml"class="code-title">Implementation for C++ 98 compilers:</span><ulxmlns="http://www.w3.org/1999/xhtml"class="code-list"><liclass="code-line"><spanclass="code-line-content"><spanclass="comment">// To declare before including glm.hpp, to use the swizzle operators</span></span></li><liclass="code-line"><spanclass="code-line-content"><spanclass="keyword">#define </span> GLM_SWIZZLE
</span></li></ul><spanxmlns="http://www.w3.org/1999/xhtml"class="code-title">Implementation for C++ 11 compilers:</span><ulxmlns="http://www.w3.org/1999/xhtml"class="code-list"><liclass="code-line"><spanclass="code-line-content"><spanclass="comment">// To declare before including glm.hpp, to use the swizzle operators</span></span></li><liclass="code-line"><spanclass="code-line-content"><spanclass="keyword">#define </span> GLM_SWIZZLE
glm::vec4 c = glm::vec4((a.zyx() + b.xyz()).xyz * 0.5f, 1.0f);
</span></li><liclass="code-line"><spanclass="code-line-content"style="padding-left:32px"><spanclass="comment">// Before being pasted to a function, a swizzle operator needs to be cast into</span></span></li><liclass="code-line"><spanclass="code-line-content"style="padding-left:32px"><spanclass="comment">// a vector either explicitly or with the operator ()</span></span></li><liclass="code-line"><spanclass="code-line-content"style="padding-left:32px">
glm::vec2 d = glm::normalize(glm::vec2(c.yz));
</span></li><liclass="code-line"><spanclass="code-line-content"style="padding-left:32px"><spanclass="comment">// glm::vec2 d = glm::normalize(c.yz()); // Equivalent code</span></span></li><liclass="code-line"><spanclass="code-line-content"style="padding-left:32px">
For now, there isn't detailed documentation, but you can freely have a look on GLSL specifications. Consider any incoherence with GLM as an error. Keep in mind the library is included in the namespace "glm".
</p><p>
This project is multi platform and was successfully tested under Visual C++ 7.1, MinGW 3.4 and GCC 3.4.
GLM 0.9.3 beta fixes various bugs and add support for <linkhref="http://code.google.com/chrome/nativeclient/">Chrome Native Client</link>
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.
</paragraph>
<paragraph>
For the feature set, the GLSL noise functions are added, based on the implementation of <linkhref="https://github.com/ashima/webgl-noise">webgl-noise</link>.
Some users might prefer the promoted GLM_GTC_noise extension also based on <linkhref="https://github.com/ashima/webgl-noise">webgl-noise</link> but with a different interface and three noise methods: Perlin noise, periodic noise and simplex noise.
</paragraph>
<imageimg="./image/0075-1.jpg"title="2D simplex noise with GLM_GTC_noise"color="'white'"/>
<paragraph>
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.
</paragraph>
<imageimg="./image/0075-2.jpg"title="Spherical random distribution with GLM_GTC_random"color="'white'"/>
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.
</paragraph>
<codetitle="Implementation for C++ 98 compilers:">
<line>
<comment>// To declare before including glm.hpp, to use the swizzle operators</comment>
</line>
<line>
<keyword>#define </keyword> GLM_SWIZZLE
</line>
<line>
<keyword>#include </keyword>
<string><glm/glm.hpp></string>
</line>
<line>
</line>
<line>
<keyword>void</keyword> example_cpp98()
</line>
<line>
{
</line>
<linealign="32px">
glm::vec4 a = glm::vec4(2, 0, 0, 0);
</line>
<linealign="32px">
glm::vec4 b = glm::vec4(0, 2, 0, 0);
</line>
<linealign="32px">
glm::vec3 c = vec4((a.zyx() + b.xyz()).xyz() * 0.5f, 1.0f);
</line>
<linealign="32px">
glm::vec2 d = glm::normalize(glm::vec2(c.yz()));
</line>
<linealign="32px">
a.xyzw() = d.xyxy();
</line>
<line>
}
</line>
</code>
<codetitle="Implementation for C++ 11 compilers:">
<line>
<comment>// To declare before including glm.hpp, to use the swizzle operators</comment>
</line>
<line>
<keyword>#define </keyword> GLM_SWIZZLE
</line>
<line>
<keyword>#include </keyword>
<string><glm/glm.hpp></string>
</line>
<line>
</line>
<line>
<keyword>void</keyword> example_cpp11()
</line>
<line>
{
</line>
<linealign="32px">
glm::vec4 a = glm::vec4(2, 0, 0, 0);
</line>
<linealign="32px">
glm::vec4 b = glm::vec4(0, 2, 0, 0);
</line>
<comment>// To use a swizzle operator with an operator, it needs to be cast into a vector either explicitly or with the operator ()</comment>
<linealign="32px">
glm::vec4 c = glm::vec4((a.zyx() + b.xyz()).xyz * 0.5f, 1.0f);
</line>
<linealign="32px">
<comment>// Before being pasted to a function, a swizzle operator needs to be cast into</comment>
</line>
<linealign="32px">
<comment>// a vector either explicitly or with the operator ()</comment>
</line>
<linealign="32px">
glm::vec2 d = glm::normalize(glm::vec2(c.yz));
</line>
<linealign="32px">
<comment>// glm::vec2 d = glm::normalize(c.yz()); // Equivalent code</comment>
GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include <glm/gtx/integer.hpp> for integer types support. Others types are not supported.");