<?xml version="1.0" encoding="utf-8" standalone="no"?><?xml-stylesheet href="./theme/orange/style.css" type="text/css"?><?xml-stylesheet href="./theme/orange/code.css" type="text/css"?><?xml-stylesheet href="./theme/orange/text.css" type="text/css"?><?xml-stylesheet href="./theme/orange/title.css" type="text/css"?><?xml-stylesheet href="./theme/orange/atom.css" type="text/css"?><?xml-stylesheet href="./theme/orange/button.css" type="text/css"?><feed xmlns="http://www.w3.org/2005/Atom"><title>G-Truc Creation - Technical</title><subtitle>G-Truc Creation - Technical</subtitle><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self"/><link href="http://www.g-truc.net/index-tech.html" lang="en" type="text/html" rel="alternate"/><id>http://www.g-truc.net/post-0743.html</id><updated>2016-04-18T23:30:00.00Z</updated><author><name>Christophe Riccio</name></author><entry><title>OpenGL Samples 4.5.2.0 released</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0741.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0741.html</id><updated>2015-09-22T23:30:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="list"><span class="list">OpenGL Samples 4.5.2.0 release notes:</span><ul class="list"><li class="list">Added gl-320-fbo-blend-points sample</li><li class="list">Added gl-400-buffer-uniform-array sample</li><li class="list">Added gl-410-buffer-uniform-array sample</li><li class="list">Added gl-430-texture-fetch-dependent sample</li><li class="list">Many updated samples</li><li class="list">Updated template images for current drivers</li><li class="list">Updated GLM to 0.9.7.1 and GLI to 0.7.1.0</li><li class="list">Fixed gl-320-draw-instanced #55</li><li class="list">Fixed gl-430-program-binary #48</li></ul></div><ul><li><a href="project-0026.html#menu">OpenGL Samples Pack <a href="https://github.com/g-truc/ogl-samples/releases/download/4.5.1.0/ogl-samples-4.5.1.0.zip">4.5.2.0</a></a>:  (<a href="https://github.com/g-truc/ogl-samples/releases/download/4.5.1.0/ogl-samples-4.5.1.0.zip">ZIP, 153.0 MB</a>)  (<a href="https://github.com/g-truc/ogl-samples/releases/download/4.5.1.0/ogl-samples-4.5.1.0.7z">7Z, 78.3 MB</a>) </li><li><a href="https://github.com/g-truc/ogl-samples/issues">Report a bug or submit a request</a></li></ul></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=OpenGL Samples 4.5.2.0 released">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc OpenGL Samples 4.5.2.0 released http://www.g-truc.net/post-0741.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0741.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0741.html&amp;title=OpenGL Samples 4.5.2.0 released&amp;summary=OpenGL Samples 4.5.2.0 released&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0741.html&amp;title=OpenGL Samples 4.5.2.0 released&amp;content=OpenGL Samples 4.5.2.0 released">Google+</a> - <a class="" href="http://www.g-truc.net/post-0741.html">Permanent link</a></h3></content></entry><entry><title>GLM 0.9.7.1 released</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0739.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0739.html</id><updated>2015-09-07T12:00:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><h5>GLM 0.9.7.1 release note</h5><div class="list"><span class="list">Improvements:</span><ul class="list"><li class="list">Improved constexpr for constant functions coverage #198</li><li class="list">Added to_string for quat and dual_quat in GTX_string_cast #375</li><li class="list">Improved overall execution time of unit tests #396</li></ul></div><div class="list"><span class="list">Fixes:</span><ul class="list"><li class="list">Fixed strict alignment warnings #235 #370</li><li class="list">Fixed link errors on compilers not supported default function #377</li><li class="list">Fixed compilation warnings in vec4</li><li class="list">Fixed non-identity quaternions for equal vectors #234</li><li class="list">Fixed excessive GTX_fast_trigonometry execution time #396</li><li class="list">Fixed Visual Studio 2015 'hides class member' warnings #394</li><li class="list">Fixed builtin bitscan never being used #392</li><li class="list">Removed unused func_noise.* files #398</li></ul></div><ul><li><a href="project-0016.html#menu">GLM 0.9.7.1</a>:  (<a href="https://github.com/g-truc/glm/releases/download/0.9.7.1/glm-0.9.7.1.zip">ZIP, 4.2 MB</a>)  (<a href="https://github.com/g-truc/glm/releases/download/0.9.7.1/glm-0.9.7.1.7z">7Z, 2.8 MB</a>) </li><li><a href="http://glm.g-truc.net">glm.g-truc.net</a></li><li><a href="http://glm.g-truc.net/0.9.7/glm-0.9.7.pdf">GLM 0.9.7 manual</a></li><li><a href="http://glm.g-truc.net/0.9.7/api/index.html">GLM 0.9.7 api documentation</a></li><li><a href="https://github.com/g-truc/glm/issues">Submit a bug report</a></li></ul></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=GLM 0.9.7.1 released">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc GLM 0.9.7.1 released http://www.g-truc.net/post-0739.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0739.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0739.html&amp;title=GLM 0.9.7.1 released&amp;summary=GLM 0.9.7.1 released&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0739.html&amp;title=GLM 0.9.7.1 released&amp;content=GLM 0.9.7.1 released">Google+</a> - <a class="" href="http://www.g-truc.net/post-0739.html">Permanent link</a></h3></content></entry><entry><title>GLI 0.7.0.0 released</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0737.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0737.html</id><updated>2015-09-01T23:30:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="list"><span class="list">GLI 0.7.0 changelog:</span><ul class="list"><li class="list">Added KTX loading and saving</li><li class="list">Added gli::load for generic file loading, either DDS or KTX files depending on filename extensions</li><li class="list">Added gli::save for generic file saving, either DDS or KTX files depending on filename extensions</li><li class="list">Added texture views using different texture format, including compressed texture formats</li><li class="list">Added fine granularity includes</li><li class="list">Improved API documentation</li><li class="list">Much faster texture comparisons is non optimal cases. (Measured ~21x faster on Intel IVB)</li><li class="list">Explicitly handling of texture targets: fixed various cases of cubemap and texture arrays failing to load with DDS</li><li class="list">Fixed GCC build</li><li class="list">Fixed warnings</li><li class="list">Fixed saved DDS header size on #52</li></ul></div><div class="code"><span class="code-title">Create OpenGL texture object from a file with the corresponding target:</span><ul class="code-list"><li class="code-line"><span class="code-line-content"><span class="keyword">#include </span><span class="string">&lt;gli/texture.hpp&gt;</span></span></li><li class="code-line"><span class="code-line-content"><span class="keyword">#include </span><span class="string">&lt;gli/load.hpp&gt;</span></span></li><li class="code-line"><span class="code-line-content"><span class="keyword">#include </span><span class="string">&lt;gli/save.hpp&gt;</span></span></li><li class="code-line"><span class="code-line-content"><span class="keyword">#include </span><span class="string">&lt;gli/gl.hpp&gt;</span></span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span class="code-line-content"><span class="comment">/// Filename can be KTX or DDS files</span></span></li><li class="code-line"><span class="code-line-content">
				GLuint createTexture(char <span class="keyword">const</span>* Filename)
			</span></li><li class="code-line"><span class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">gli::texture Texture = gli::load(Filename);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">if</span>(Texture.empty())
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">return</span> 0;
			</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">gli::gl GL;</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">
				gli::gl::format <span class="keyword">const</span> Format = GL.translate(Texture.format());
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">GLenum Target = GL.translate(Texture.target());</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">GLuint TextureName = 0;</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glGenTextures(1, &amp;TextureName);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glBindTexture(Target, TextureName);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(Target, GL_TEXTURE_BASE_LEVEL, 0);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">
				glTexParameteri(Target, GL_TEXTURE_MAX_LEVEL, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels() - 1));
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_R, Format.Swizzle[0]);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_G, Format.Swizzle[1]);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_B, Format.Swizzle[2]);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_A, Format.Swizzle[3]);</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">
				glm::tvec3&lt;GLsizei&gt; <span class="keyword">const</span> Dimensions(Texture.dimensions());
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">
				GLsizei <span class="keyword">const</span> FaceTotal = <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.layers() * Texture.faces());
			</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">switch</span>(Texture.target())
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_1D:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">
				glTexStorage1D(Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()), Format.Internal, Dimensions.x);
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_1D_ARRAY:
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_2D:
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_CUBE:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">glTexStorage2D(</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()), Format.Internal,
			</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">Dimensions.x, Texture.target() == gli::TARGET_2D ? Dimensions.y : FaceTotal);</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_2D_ARRAY:
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_3D:
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_CUBE_ARRAY:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">glTexStorage3D(</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()), Format.Internal,
			</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">Dimensions.x, Dimensions.y, Texture.target() == gli::TARGET_3D ? Dimensions.z : FaceTotal);</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">default</span>: assert(0); break;
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">}</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">for</span>(std::size_t Layer = 0; Layer &lt; Texture.layers(); ++Layer)
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">for</span>(std::size_t Face = 0; Face &lt; Texture.faces(); ++Face)
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">for</span>(std::size_t Level = 0; Level &lt; Texture.levels(); ++Level)
			</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">
				GLsizei <span class="keyword">const</span> LayerGL = <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Layer);
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">glm::tvec3&lt;GLsizei&gt; Dimensions(Texture.dimensions(Level));</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">if</span>(gli::is_target_cube(Texture.target()))
			</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">
				Target = <span class="keyword">static_cast</span>&lt;GLenum&gt;(GL_TEXTURE_CUBE_MAP_POSITIVE_X + Face);
			</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">switch</span>(Texture.target())
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_1D:
			</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))
			</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">glCompressedTexSubImage1D(</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, Dimensions.x,
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Format.Internal, <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.size(Level)),
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">else</span></span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">glTexSubImage1D(</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, Dimensions.x, Format.External, Format.Type,
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_1D_ARRAY:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_2D:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_CUBE:
			</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))
			</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">glCompressedTexSubImage2D(</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0,
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Dimensions.x, Texture.target() == gli::TARGET_1D_ARRAY ? : Dimensions.y,</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Format.Internal, <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.size(Level)),
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">else</span></span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">glTexSubImage2D(</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0,
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Dimensions.x, Texture.target() == gli::TARGET_1D_ARRAY ? LayerGL : Dimensions.y,</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Format.External, Format.Type, Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">break;</span></span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_2D_ARRAY:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_3D:
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">case</span> gli::TARGET_CUBE_ARRAY:
			</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))
			</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">glCompressedTexSubImage3D(</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0, 0,
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Dimensions.x, Dimensions.y, Texture.target() == gli::TARGET_3D ? Dimensions.z : LayerGL,</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Format.Internal, <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.size(Level)),
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">else</span></span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">glTexSubImage3D(</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0, 0,
			</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Dimensions.x, Dimensions.y, Texture.target() == gli::TARGET_3D ? Dimensions.z : LayerGL,</span></li><li class="code-line"><span style="padding-left:160px" class="code-line-content">Format.External, Format.Type, Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">default</span>: assert(0); <span class="keyword">break</span>;
			</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">}</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">}</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">return</span> TextureName;
			</span></li><li class="code-line"><span class="code-line-content">}</span></li></ul></div><li><a href="project-0024.html#menu">GLI 0.7.0.0</a>:  (<a href="https://github.com/g-truc/gli/releases/download/0.7.0.0/gli-0.7.0.0.zip">ZIP, 12.2 MB</a>)  (<a href="https://github.com/g-truc/gli/releases/download/0.7.0.0/gli-0.7.0.0.7z">7Z, 7.2 MB</a>) </li><li><a href="https://github.com/g-truc/gli/issues">Submit a bug report</a></li><li><a href="http://gli.g-truc.net/0.7.0/api/index.html">GLI 0.7.0 API</a></li></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=GLI 0.7.0.0 released">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc GLI 0.7.0.0 released http://www.g-truc.net/post-0737.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0737.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0737.html&amp;title=GLI 0.7.0.0 released&amp;summary=GLI 0.7.0.0 released&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0737.html&amp;title=GLI 0.7.0.0 released&amp;content=GLI 0.7.0.0 released">Google+</a> - <a class="" href="http://www.g-truc.net/post-0737.html">Permanent link</a></h3></content></entry><entry><title>GLM 0.9.7.0 released</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0736.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0736.html</id><updated>2015-08-02T12:00:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><h5>GLM 0.9.7.0 release note</h5><div class="list"><span class="list">Features:</span><ul class="list"><li class="list">Added GTC_color_space: convertLinearToSRGB and convertSRGBToLinear functions</li><li class="list">Added 'fmod' overload to GTX_common with tests #308</li><li class="list">Added left handed perspective and lookAt functions #314</li><li class="list">Added functions eulerAngleXYZ and extractEulerAngleXYZ #311</li><li class="list">Added GTX_hash to perform std::hash on GLM types #320 #367</li><li class="list">Added GTX_wrap for texcoord wrapping</li><li class="list">Added static components and precision members to all vector and quat types #350</li><li class="list">Added .gitignore #349</li><li class="list">Added support of defaulted functions to GLM types, to use them in unions #366</li></ul></div><div class="list"><span class="list">Improvements:</span><ul class="list"><li class="list">Changed usage of __has_include to support Intel compiler #307</li><li class="list">Specialized integer implementation of YCoCg-R #310</li><li class="list">Don't show status message in 'FindGLM' if 'QUIET' option is set. #317</li><li class="list">Added master branch continuous integration service on Linux 64 #332</li><li class="list">Clarified manual regarding angle unit in GLM, added FAQ 11 #326</li><li class="list">Updated list of compiler versions</li></ul></div><div class="list"><span class="list">Fixes:</span><ul class="list"><li class="list">Fixed default precision for quat and dual_quat type #312</li><li class="list">Fixed (u)int64 MSB/LSB handling on BE archs #306</li><li class="list">Fixed multi-line comment warning in g++ #315</li><li class="list">Fixed specifier removal by 'std::make_pair' #333</li><li class="list">Fixed perspective fovy argument documentation #327</li><li class="list">Removed -m64 causing build issues on Linux 32 #331</li><li class="list">Fixed isfinite with C++98 compilers #343</li><li class="list">Fixed Intel compiler build error on Linux #354</li><li class="list">Fixed use of libstdc++ with Clang #351</li><li class="list">Fixed quaternion pow #346</li><li class="list">Fixed decompose warnings #373</li><li class="list">Fixed matrix conversions #371</li></ul></div><div class="list"><span class="list">Deprecation:</span><ul class="list"><li class="list">Removed integer specification for 'mod' in GTC_integer #308</li><li class="list">Removed GTX_multiple, replaced by GTC_round</li></ul></div><ul><li><a href="project-0016.html#menu">GLM 0.9.7.0</a>:  (<a href="https://github.com/g-truc/glm/releases/download/0.9.7.0/glm-0.9.7.0.zip">ZIP, 4.2 MB</a>)  (<a href="https://github.com/g-truc/glm/releases/download/0.9.7.0/glm-0.9.7.0.7z">7Z, 2.8 MB</a>) </li><li><a href="http://glm.g-truc.net">glm.g-truc.net</a></li><li><a href="http://glm.g-truc.net/0.9.7/glm-0.9.7.pdf">GLM 0.9.7 manual</a></li><li><a href="http://glm.g-truc.net/0.9.7/api/index.html">GLM 0.9.7 api documentation</a></li><li><a href="https://github.com/g-truc/glm/issues">Submit a bug report</a></li></ul></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=GLM 0.9.7.0 released">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc GLM 0.9.7.0 released http://www.g-truc.net/post-0736.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0736.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0736.html&amp;title=GLM 0.9.7.0 released&amp;summary=GLM 0.9.7.0 released&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0736.html&amp;title=GLM 0.9.7.0 released&amp;content=GLM 0.9.7.0 released">Google+</a> - <a class="" href="http://www.g-truc.net/post-0736.html">Permanent link</a></h3></content></entry><entry><title>Texture swizzling in OpenGL, OpenGL ES and WebGL</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0734.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0734.html</id><updated>2015-07-20T23:30:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><p>
			When targeting a large amount of platform, by coincidence OpenGL 3.2 to 4.5, OpenGL ES 2.0 to ES 3.1+ and WebGL 1.0 and 2.0,
			it takes quite some investigations to implement a feature optimally. The difference between doing this investigation and not doing it is basically shipping a buggy engine.
			As an example, let's study texture swizzle and how it's exposed in OpenGL, OpenGL ES and WebGL.
		</p><h4>1. Configurable texture swizzling</h4><p><a href="https://www.opengl.org/registry/specs/EXT/texture_swizzle.txt">GL_EXT_texture swizzle</a>,
			promoted to OpenGL 3.3 core specifiction through <a href="https://www.opengl.org/registry/specs/ARB/texture_swizzle.txt">GL_ARB_texture_swizzle</a> extension,
			introduced a functionality  to handle texture with arbitrary ordering or the components without requiring CPU reordering.
			For example, it allows loading BGRA8 or ARGB8 source textures to OpenGL RGBA8 texture object.
		</p><p>
			With OpenGL 3.3 and OpenGL ES 3.0, loading a BGRA8 texture can be done using the following approach:
		</p><div class="code"><span class="code-title">OpenGL 3.3 and OpenGL ES 3.0 BGRA texture swizzling, a channel at a time:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">GLint const Swizzle[] = {GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA};</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, Swizzle[0]);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, Swizzle[1]);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, Swizzle[2]);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, Swizzle[3]);</span></li><li class="code-line"><span class="code-line-content">glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			OpenGL 3.3, <a href="https://www.opengl.org/registry/specs/ARB/texture_swizzle.txt">GL_ARB_texture_swizzle</a>
			and <a href="https://www.opengl.org/registry/specs/EXT/texture_swizzle.txt">GL_EXT_texture swizzle</a>
			provides a slightly different approach that is not available with OpenGL ES 3.0:
		</p><div class="code"><span class="code-title">OpenGL 3.3 BGRA texture swizzling, all channels at once:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">GLint <span class="keyword">const</span> Swizzle[] = {GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA};</span></li><li class="code-line"><span class="code-line-content">glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, Swizzle);</span></li><li class="code-line"><span class="code-line-content">glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Width, Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			Unfortunately, <a href="https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.18">neither WebGL 1.0 or WebGL 2.0 support texture swizzle</a>
			due to performance issue of implementation such feature on top of Direct3D which doesn't have any equivalent functionality.
		</p><div class="list"><span class="list">Support:</span><ul class="list"><li class="list">Any OpenGL 3.3 or OpenGL ES 3.0 driver</li><li class="list"><a href="https://developer.apple.com/opengl/capabilities/index.html">MacOSX 10.8 through GL_ARB_texture_swizzle using the OpenGL 3.2 core driver</a></li><li class="list"><a href="http://delphigl.de/glcapsviewer/gl_generatereport.php?reportID=888">Intel SandyBridge through GL_EXT_texture swizzle</a></li></ul></div><div class="list"><span class="list">Known driver bugs:</span><ul class="list"><li class="list">NVIDIA ES drivers (353.12) won't generate an invalid enum error if <span class="codeword">GL_TEXTURE_SWIZZLE_RGBA</span> is used</li><li class="list">Intel ES drivers (4222) won't generate an invalid enum error if <span class="codeword">GL_TEXTURE_SWIZZLE_RGBA</span> is used</li></ul></div><h4>2. BGRA texture swizzling using texture formats</h4><p>
			OpenGL supports GL_BGRA external format to load BGRA8 source textures without requiring the application to swizzle the source data. This is done using the following code:
		</p><div class="code"><span class="code-title">OpenGL core and compatibility profiles BGRA swizzling with texture image:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Width, Height, 0, GL_BGRA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><div class="code"><span class="code-title">OpenGL core and compatibility profiles BGRA swizzling with texture storage:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, Width, Height);</span></li><li class="code-line"><span class="code-line-content">glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, Width, Height, GL_BGRA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			However, such functionnality isn't available with OpenGL ES. While, it's not useful for OpenGL ES 3.0 that has texture swizzling support,
			OpenGL ES 2.0 relies on some extensions to expose this feature but it does it differently than OpenGL.
		</p><p>
			Using the <a href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt">GL_EXT_texture_format_BGRA8888</a>
			or <a href="https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_format_BGRA8888.txt">GL_APPLE_texture_format_BGRA8888</a> extensions,
			loading BGRA textures is done with the following code:
		</p><div class="code"><span class="code-title">OpenGL core and compatibility profiles BGRA swizzling with texture image:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, Width, Height, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			When <a href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_storage.txt">GL_EXT_texture_storage</a> (ES2) is supported, BGRA texture loading is perform with the following code.
		</p><div class="code"><span class="code-title">OpenGL core and compatibility profiles BGRA swizzling with texture image:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexStorage2D(GL_TEXTURE_2D, 1, GL_BGRA8_EXT, Width, Height);</span></li><li class="code-line"><span class="code-line-content">glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, Width, Height, GL_BGRA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			To understand the difference between OpenGL, OpenGL ES and OpenGL ES with texture storage the reasoning  is the following:
			On the contrary to OpenGL, OpenGL ES doesn't support external format to internal format conversion of any kind, including texture component swizzling.
			Additionally, OpenGL ES 2.0 requires unsized format for the internal format while OpenGL ES 3.0 and texture storage requires sized internal format.
		</p><div class="list"><span class="list">Support:</span><ul class="list"><li class="list"><a href="http://delphigl.de/glcapsviewer/gl_listreports.php?listreportsbyextension=GL_EXT_bgra">Any driver supporting OpenGL 1.2 or GL_EXT_bgra including OpenGL core profile</a></li><li class="list"><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_EXT_texture_format_BGRA8888">Adreno 200, Mali 400, PowerVR series 5, Tegra 3, Videocore IV and GC1000 through GL_EXT_texture_format_BGRA8888</a></li><li class="list"><a href="https://developer.apple.com/library/ios/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/OpenGLESPlatforms/OpenGLESPlatforms.html">iOS through GL_APPLE_texture_format_BGRA8888</a></li><li class="list"><a href="https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_format_BGRA8888.txt">GC1000 through GL_APPLE_texture_format_BGRA8888</a></li><li class="list"><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_IMG_texture_format_BGRA8888">PowerVR series 5 through GL_IMG_texture_format_BGRA8888</a></li></ul></div><h4>3. Texture alpha swizzling</h4><p>
			In this section, we call a texture alpha, a texture we using the alpha channel (.a, .w, .q) in a shader.
			With OpenGL ES and WebGL, this can be done by creating a texture with an alpha format as shown with the following code samples.
		</p><div class="code"><span class="code-title">OpenGL ES 2.0 texture alpha:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, Width, Height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><div class="code"><span class="code-title">OpenGL ES 3.0 texture alpha:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexStorage2D(GL_TEXTURE_2D, 1, GL_ALPHA8, Width, Height);</span></li><li class="code-line"><span class="code-line-content">glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, Width, Height, GL_ALPHA, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			Texture alpha format is also available in OpenGL compatibility profile and WebGL but was removed in OpenGL core profile.
			An alternative is to rely on <a href="https://www.opengl.org/registry/specs/ARB/texture_rg.txt">texture red format</a>
			and texture swizzle as shown with the following code samples.
		</p><p>
			On one hand, both OpenGL ES and OpenGL compatibility profile supports texture alpha and luminance alpha.
			However, OpenGL core profile doesn't. On other hand, OpenGL 3.0 and OpenGL ES 3.0 support texture red and texture red green.
		</p><div class="code"><span class="code-title">OpenGL 3.3 and OpenGL ES 3.0 texture alpha:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ZERO);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ZERO);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ZERO);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED);</span></li><li class="code-line"><span class="code-line-content">glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, Width, Height, 0, GL_RED, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><div class="code"><span class="code-title">OpenGL 4.2 and OpenGL ES 3.0 texture alpha with texture storage:</span><ul class="code-list"><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ZERO);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ZERO);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ZERO);</span></li><li class="code-line"><span class="code-line-content">glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED);</span></li><li class="code-line"><span class="code-line-content">glTexStorage2D(GL_TEXTURE_2D, 1, GL_R8, Width, Height);</span></li><li class="code-line"><span class="code-line-content">glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, Width, Height, GL_RED, GL_UNSIGNED_BYTE, Data);</span></li></ul></div><p>
			Texture red format was introduced on desktop with OpenGL 3.0 and <a href="https://www.opengl.org/registry/specs/ARB/texture_rg.txt">GL_ARB_texture_rg</a>.
			On OpenGL ES, it was introduced with OpenGL ES 3.0 and <a href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_rg.txt">GL_EXT_texture_rg</a>.
		</p><p>
			Unfortunately, OpenGL 3.2 core profile doesn't support either texture alpha format or texture swizzling.
			A possible workaround is to expend the source data to RGBA8 which consumes 4 times the memory which might be necessary to support texture alpha on MacOSX 10.7.
		</p><div class="list"><span class="list">Support:</span><ul class="list"><li class="list"><a href="http://delphigl.de/glcapsviewer/listreports2.php?listreportsbyextension=GL_ARB_texture_rg">Texture red format is supported on any OpenGL 3.0 or OpenGL ES 3.0 driver</a></li><li class="list"><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_EXT_texture_rg">Texture red format is supported on PowerVR series 5, Mali 600 series, Tegra and Bay Trail on Android through <a href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_rg.txt">GL_EXT_texture_rg</a></a></li><li class="list"><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_EXT_texture_rg">
				Texture red format is supported on iOS through <a href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_rg.txt">GL_EXT_texture_rg</a></a></li></ul></div><p>
			Enjoy!
		</p><li><a href="http://delphigl.de/glcapsviewer/listreports2.php?listreportsbyextension=GL_ARB_texture_swizzle">GL_ARB_texture_swizzle support on Windows and Linux</a></li><li><a href="http://delphigl.de/glcapsviewer/listreports2.php?listreportsbyextension=GL_EXT_texture_swizzle">GL_EXT_texture_swizzle support on Windows and Linux</a></li><li><a href="http://delphigl.de/glcapsviewer/listreports2.php?listreportsbyextension=GL_ARB_texture_rg">GL_ARB_texture_rg support on Windows and Linux</a></li><li><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_EXT_texture_rg">GL_EXT_texture_rg support on Android</a></li><li><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_EXT_texture_format_BGRA8888">GL_EXT_texture_format_BGRA8888 support on Android</a></li><li><a href="http://delphigl.de/glcapsviewer/gles_listreports.php?extension=GL_APPLE_texture_format_BGRA8888">GL_APPLE_texture_format_BGRA8888 support on Android</a></li><li><a href="https://developer.apple.com/opengl/capabilities/index.html">OSX OpenGL extensions</a></li><li><a href="https://developer.apple.com/library/ios/documentation/DeviceInformation/Reference/iOSDeviceCompatibility/OpenGLESPlatforms/OpenGLESPlatforms.html">iOS OpenGL extensions</a></li></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=Texture swizzling in OpenGL, OpenGL ES and WebGL">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc Texture swizzling in OpenGL, OpenGL ES and WebGL http://www.g-truc.net/post-0734.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0734.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0734.html&amp;title=Texture swizzling in OpenGL, OpenGL ES and WebGL&amp;summary=Texture swizzling in OpenGL, OpenGL ES and WebGL&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0734.html&amp;title=Texture swizzling in OpenGL, OpenGL ES and WebGL&amp;content=Texture swizzling in OpenGL, OpenGL ES and WebGL">Google+</a> - <a class="" href="http://www.g-truc.net/post-0734.html">Permanent link</a></h3></content></entry><entry><title>GLI 0.6.1.1 released</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0732.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0732.html</id><updated>2015-07-18T23:30:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="list"><span class="list">GLI 0.6.1 changelog:</span><ul class="list"><li class="list">Fixed interface inconsistencies</li><li class="list">Improved clear(), data() and size() performance using caching</li><li class="list">Removed internal dependence to std::fstream</li><li class="list">Added FORMAT_BGRX8_UNORM and FORMAT_BGRX8_SRGB support #48, #43</li><li class="list">Improved FORMAT_RGB8_UNORM loading</li></ul></div><p>
			GLI is still at an alpha stage but hopefully it's already useful for some people. <a href="https://github.com/g-truc/gli/issues">Please contribute! :D</a></p><li><a href="project-0024.html#menu">GLI 0.6.1.1</a>:  (<a href="https://github.com/g-truc/gli/releases/download/0.6.1.1/gli-0.6.1.1.zip">ZIP, 9.0 MB</a>)  (<a href="https://github.com/g-truc/gli/releases/download/0.6.1.1/gli-0.6.1.1.7z">7Z, 5.7 MB</a>) </li><li><a href="https://github.com/g-truc/gli/issues">Submit a bug report</a></li><li><a href="http://gli.g-truc.net/0.6.1/api/index.html">GLI 0.6.1 API</a></li></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=GLI 0.6.1.1 released">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc GLI 0.6.1.1 released http://www.g-truc.net/post-0732.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0732.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0732.html&amp;title=GLI 0.6.1.1 released&amp;summary=GLI 0.6.1.1 released&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0732.html&amp;title=GLI 0.6.1.1 released&amp;content=GLI 0.6.1.1 released">Google+</a> - <a class="" href="http://www.g-truc.net/post-0732.html">Permanent link</a></h3></content></entry><entry><title>GLI 0.6.0.0 released</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0730.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0730.html</id><updated>2015-06-28T23:30:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="list"><span class="list">GLI 0.6.0.0 changelog:</span><ul class="list"><li class="list">Large refactoring</li><li class="list">Added loading DDS from memory</li><li class="list">Added saving DDS to memory</li><li class="list">Improved DDS coverage for R, RG, RGB and RGBA formats</li><li class="list">Added DDS ASTC, PVRTC, ATC and ETC support</li><li class="list">Added DDS alpha, luminance and alpha luminance support</li><li class="list">Added PVRTC2, ETC2 and EAC formats</li></ul></div><div class="code"><span class="code-title">Loading a DDS file to OpenGL texture object:</span><ul class="code-list"><li class="code-line"><span class="code-line-content"><span class="keyword">#include </span><span class="string">&lt;gli/gli.hpp&gt;</span></span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span class="code-line-content">GLuint CreateTextureArray(<span class="keyword">char </span><span class="keyword">const</span>* Filename)</span></li><li class="code-line"><span class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">gli::texture2D Texture(gli::load_dds(Filename));</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">assert(!Texture.empty());</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">gli::gl GL;</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">gli::gl::format <span class="keyword">const</span> Format = GL.translate(Texture.format());</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">GLuint TextureName = 0;</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glGenTextures(1, &amp;TextureName);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glBindTexture(GL_TEXTURE_2D_ARRAY, TextureName);</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BASE_LEVEL, 0);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels() - 1));</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_R, Format.Swizzle[0]);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_G, Format.Swizzle[1]);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_B, Format.Swizzle[2]);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_SWIZZLE_A, Format.Swizzle[3]);</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glTexStorage3D(GL_TEXTURE_2D_ARRAY, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()),</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">Format.Internal,</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.dimensions().x),</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.dimensions().y),</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(1));</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">for</span>(std::size_t Level = 0; Level &lt; Texture.levels(); ++Level)</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">glCompressedTexSubImage3D(GL_TEXTURE_2D_ARRAY, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">0, 0, 0,</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture[Level].dimensions().x),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture[Level].dimensions().y),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(1),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">Format.External,</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture[Level].size()),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">Texture[Level].data());</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">}</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">}</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">else</span></span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">for</span>(std::size_t Level = 0; Level &lt; Texture.levels(); ++Level)</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">glTexSubImage3D(GL_TEXTURE_2D_ARRAY, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">0, 0, 0,</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture[Level].dimensions().x),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture[Level].dimensions().y),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content"><span class="keyword">static_cast</span>&lt;GLsizei&gt;(1),</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">Format.External, Format.Type,</span></li><li class="code-line"><span style="padding-left:128px" class="code-line-content">Texture[Level].data());</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content">}</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">}</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">return</span> TextureName;</span></li><li class="code-line"><span class="code-line-content">}</span></li></ul></div><p>
			GLI is still at an alpha stage but hopefully it's already useful for some people. <a href="https://github.com/g-truc/gli/issues">Please contribute! :D</a></p><li><a href="project-0024.html#menu">GLI 0.6.0.0</a>:  (<a href="https://github.com/g-truc/gli/releases/download/0.6.0.0/gli-0.6.0.0.zip">ZIP, 8.6 MB</a>)  (<a href="https://github.com/g-truc/gli/releases/download/0.6.0.0/gli-0.6.0.0.7z">7Z, 5.5 MB</a>) </li><li><a href="https://github.com/g-truc/gli/issues">Submit a bug report</a></li><li><a href="http://gli.g-truc.net/0.6.0/api/index.html">GLI 0.6.0 API</a></li></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=GLI 0.6.0.0 released">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc GLI 0.6.0.0 released http://www.g-truc.net/post-0730.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0730.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0730.html&amp;title=GLI 0.6.0.0 released&amp;summary=GLI 0.6.0.0 released&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0730.html&amp;title=GLI 0.6.0.0 released&amp;content=GLI 0.6.0.0 released">Google+</a> - <a class="" href="http://www.g-truc.net/post-0730.html">Permanent link</a></h3></content></entry><entry><title>June 2015 OpenGL hardware matrix: Intel Sandy Bridge</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0729.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0729.html</id><updated>2015-06-19T23:00:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><p>
			These days, I am working on Intel Sandy Bridge architecture OpenGL support.
		</p><p>
			If Intel Ivy Bridge is already pretty hard to support with its OpenGL 4.0 support, Sandy Bridge is another kind of challenge:
			OpenGL 3.1 support with no core profile. Unfortunately, released in 2011, Sandy Bridge is a bad GPU with 2009 OpenGL support that is a still a good CPU architecture largely used as Unity stats shows.
		</p><div class="post-image-white"><a href="./post/0729-1.png"><img alt="Unity Windows editor stats for April 2015" src="./post/0729-1-small.png"/></a></div><div class="post-image-title">Unity Windows editor stats for April 2015</div><p>
			Sandy Bridge (HD 2000 / HD 3000) is 9.8% of the Unity editor users and one of the most used GPU architectures.
		</p><div class="post-image-white"><a href="./doc/OpenGL%204%20Hardware%20Matrix%202015-06.pdf"><img alt="Exposed extensions to all OpenGL 4 hardware on the lastest drivers available to date" src="./post/0729-2.png"/></a></div><div class="post-image-title">Exposed extensions to all OpenGL 4 hardware on the lastest drivers available to date</div><p>
			In practice, Sandy Bridge supports OpenGL 3.1 with all the OpenGL 3.2 extensions but <a href="https://www.opengl.org/registry/specs/ARB/texture_multisample.txt">ARB_texture_multisample</a>.
		</p><p>
			Additionally, Sandy Bridge supports six OpenGL 3.3 extensions: 
			<a href="https://www.opengl.org/registry/specs/ARB/vertex_type_2_10_10_10_rev.txt">ARB_vertex_type_2_10_10_10_rev</a>,
			<a href="https://www.opengl.org/registry/specs/ARB/timer_query.txt">ARB_timer_query</a>,
			<a href="https://www.opengl.org/registry/specs/ARB/texture_rgb10_a2ui.txt">ARB_texture_rgb10_a2ui</a>,
			<a href="https://www.opengl.org/registry/specs/ARB/shader_bit_encoding.txt">ARB_shader_bit_encoding</a>,
			<a href="https://www.opengl.org/registry/specs/ARB/occlusion_query2.txt">ARB_occlusion_query2</a> and
			<a href="https://www.opengl.org/registry/specs/ARB/explicit_attrib_location.txt">ARB_explicit_attrib_location</a>.
		</p><p>
			Finally, Sandy Bridge supports three OpenGL 4.0 extensions:
			<a href="https://www.opengl.org/registry/specs/ARB/texture_query_lod.txt">ARB_texture_query_lod</a>,
			<a href="https://www.opengl.org/registry/specs/ARB/texture_buffer_object_rgb32.txt">ARB_texture_buffer_object_rgb32</a> and
			<a href="https://www.opengl.org/registry/specs/ARB/draw_buffers_blend.txt">draw_buffers_blend</a>.
		</p><p>
			By giving up on feature support, basically at the release of an architecture, Intel has been able to provide pretty good drivers on the lastest architectures (Haswell / Broadwell), both in term of quality and feature set (OpenGL 4.3).
		</p><p>
			However, it is very unfortunate that anything older is more complex to support than a good old <a href="http://delphigl.de/glcapsviewer/gl_generatereport.php?reportID=603">GeForce 8</a>, released 9 years ago.
			Sadly, it can get worse! Older architectures than Sandy Bridge, that is GMA (OpenGL 1.4), GMA HD (OpenGL 2.0) and Ironlake HD Graphics (OpenGL 2.1) represent 12.9% of the editor users.
		</p><p>
			Lastly, Intel GPU names are dreadful: It was aweful back at the GMA time, it is still just as bad. For example, "Intel HD Graphics" (without any numbering) has been used for Clarkdale, Arrandale, Sandy Bridge, Ivy Bridge, Haswell, Bay Trail, Broadwell and Braswell.
		</p><ul><li><a href="project-0034.html#menu">OpenGL Hardware Matrix <a href="doc/OpenGL%204%20Hardware%20Matrix%202015-06.pdf">Jun. 2015</a></a>:  (<a href="doc/OpenGL%204%20Hardware%20Matrix%202015-06.pdf">PDF, 547 KB</a>)  (<a href="doc/OpenGL%204%20Hardware%20Matrix.xlsx">XLSX, 369 KB</a>) </li><li><a href="http://delphigl.de/glcapsviewer/gl_generatereport.php?reportID=851">glCapsViewer report for Intel HD Graphics 9.17.10.4101 (Sandy Bridge)</a></li><li><a href="http://delphigl.de/glcapsviewer/gl_generatereport.php?reportID=869">glCapsViewer report for Intel HD Graphics 4000 10.18.10.4226 (Ivy Bridge)</a></li><li><a href="http://delphigl.de/glcapsviewer/gl_generatereport.php?reportID=862">glCapsViewer report for Intel HD Graphics 4600 10.18.14.4222 (Haswell)</a></li><li><a href="http://delphigl.de/glcapsviewer/gl_generatereport.php?reportID=848">glCapsViewer report for Intel HD Graphics 6000 10.18.14.4170 (Broadwell)</a></li></ul></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=June 2015 OpenGL hardware matrix: Intel Sandy Bridge">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc June 2015 OpenGL hardware matrix: Intel Sandy Bridge http://www.g-truc.net/post-0729.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0729.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0729.html&amp;title=June 2015 OpenGL hardware matrix: Intel Sandy Bridge&amp;summary=June 2015 OpenGL hardware matrix: Intel Sandy Bridge&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0729.html&amp;title=June 2015 OpenGL hardware matrix: Intel Sandy Bridge&amp;content=June 2015 OpenGL hardware matrix: Intel Sandy Bridge">Google+</a> - <a class="" href="http://www.g-truc.net/post-0729.html">Permanent link</a></h3></content></entry><entry><title>EuroLLVM slides about SPIR-V</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0724.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0724.html</id><updated>2015-04-19T23:30:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><p>
			The <a href="./doc/2015%20-%20EuroLLVM%20-%20SPIR-V.pdf">slides</a> from my presentation at EuroLLVM.
		</p><ul><li><a href="./doc/2015%20-%20EuroLLVM%20-%20SPIR-V.pdf">Slides</a></li><li><a href="post-0714.html">Redefining the shading languages ecosystem with SPIR-V</a></li><li><a href="https://www.khronos.org/registry/spir-v/papers/WhitePaper.pdf">SPIR-V: whitepaper</a></li><li><a href="https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.pdf">SPIR-V 0.99, provisiontal specification</a></li><li><a href="https://www.khronos.org/registry/spir-v/specs/1.0/GLSL.std.450.pdf">SPIR-V Extended Instructions for GLSL, provisiontal specification</a></li><li><a href="https://www.khronos.org/registry/spir-v/specs/1.0/OpenCL.std.21.pdf">SPIR-V OpenCL 2.1 Extended Instruction Set, provisiontal specification</a></li><li><a href="https://www.khronos.org/spir">SPIR-V front page</a></li><li><a href="https://www.khronos.org/vulkan">Vulkan front page</a></li></ul></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=EuroLLVM slides about SPIR-V">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc EuroLLVM slides about SPIR-V http://www.g-truc.net/post-0724.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0724.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0724.html&amp;title=EuroLLVM slides about SPIR-V&amp;summary=EuroLLVM slides about SPIR-V&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0724.html&amp;title=EuroLLVM slides about SPIR-V&amp;content=EuroLLVM slides about SPIR-V">Google+</a> - <a class="" href="http://www.g-truc.net/post-0724.html">Permanent link</a></h3></content></entry><entry><title>March 2015 OpenGL drivers status and FB sRGB conversions</title><link href="http://www.g-truc.net/post-tech.atom" type="application/atom+xml" rel="self" lang="en"/><link href="http://www.g-truc.net/post-0720.html" type="text/html" rel="alternate" lang="en"/><id>http://www.g-truc.net/post-0720.html</id><updated>2015-03-29T23:00:00.00Z</updated><content xml:lang="en" type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><p>
			After a long 8 months pause, once again, I tested my OpenGL samples on available OpenGL desktop drivers. This post is a report on whether these samples ran successfully. My OpenGL samples are not a conformance test, only a set of 212 OpenGL code samples I accumulated over time. I haven't updated MacOSX or Linux results.
		</p><h4>Focus on sRGB framebuffer conversion with OpenGL and OpenGL ES</h4><p>
			sRGB conversions is typically a pretty buggy area particularly on MacOSX. On Windows, it looks like that every hardware vendors got it somewhat wrong with OpenGL core and compatibility profile. How to explain this? AMD and Intel have followed NVIDIA behaviors which dominates the OpenGL desktop ecosystem.
		</p><p>
			This is attitude of following NVIDIA behaviors is pretty striking considering for example that Intel behaviors used to make the most sense and used to follow the specification.
		</p><p>
			However, NVIDIA behavior is not correct to my understanding build from reading the OpenGL specification and many experiments. Not following the specification is not necessary a bad thing as we observe on <a href="http://www.g-truc.net/post-0644.html#menu">the point rendering case study</a>, however on the framebuffer sRGB conversion case, NVIDIA behavior only implies rendering garbage as shown in figure 3.
			So, what the OpenGL core profile specification says?
		</p><p class="quote">
			If <span class="codeword">FRAMEBUFFER_SRGB</span> is enabled and the value of <span class="codeword">FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</span> for the framebuffer attachment corresponding to the destination buffer is SRGB (see section 6.1.3), the R, G, and B values after blending are converted into the non-linear sRGB color space.
		<span class="quote-author"><a href="https://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt">OpenGL core framebuffer sRGB conversion rules</a></span></p><p>
			OpenGL ES is slightly different: <span class="codeword">GL_FRAMEBUFFER_SRGB</span> doesn't exist so that framebuffer sRGB conversion only depends on the <span class="codeword">GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</span>.
		</p><p class="quote">
			If the value of <span class="codeword">FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</span> for the framebuffer attachment corresponding to the destination buffer is SRGB (see section 9.2.3), the R, G, and B values after blending are converted into the non-linear sRGB color space.
		<span class="quote-author"><a href="https://www.khronos.org/registry/gles/specs/3.1/es_spec_3.1.withchanges.pdf">OpenGL ES framebuffer sRGB conversion rules</a></span></p><p>
			This hightlight a OpenGL core and OpenGL ES incompatibility: OpenGL ES behaves as if <span class="codeword">GL_FRAMEBUFFER_SRGB</span> was already enabled where on desktop <span class="codeword">GL_FRAMEBUFFER_SRGB</span> is disabled by default.
		</p><p>
			Following this reasonning a quick interpretation would be that to handle this imcompatibility, we could simply enable <span class="codeword">GL_FRAMEBUFFER_SRGB</span> at initialization on desktop. Unfortunately, this is not working in practice as shown in figure 3.
		</p><div class="post-image-white"><a href="./post/0720-linear.png"><img alt="Figure 1: Fully linear framebuffer rendering" src="./post/0720-crop-linear.png"/></a></div><div class="post-image-title">Figure 1: Fully linear framebuffer rendering</div><div class="post-image-white"><a href="./post/0720-srgb_disable_on_fbo_0.png"><img alt="Figure 2: sRGB intermediate framebuffer with explicitly disable conversion on default framebuffer" src="./post/0720-crop-srgb_disable_on_fbo_0.png"/></a></div><div class="post-image-title">Figure 2: sRGB intermediate framebuffer with explicitly disable conversion on default framebuffer</div><div class="post-image-white"><a href="./post/0720-srgb_enable_always.png"><img alt="Figure 3: Always enabled framebuffer sRGB conversion on OpenGL core profile: What we see here is sRGB data being interpreted as RGB, just as in 5" src="./post/0720-crop-srgb_enable_always.png"/></a></div><div class="post-image-title">Figure 3: Always enabled framebuffer sRGB conversion on OpenGL core profile: What we see here is sRGB data being interpreted as RGB, just as in 5</div><div class="post-image-white"><a href="./post/0720-es.png"><img alt="Figure 4: Always enabled framebuffer sRGB conversion on OpenGL ES profile" src="./post/0720-crop-es.png"/></a></div><div class="post-image-title">Figure 4: Always enabled framebuffer sRGB conversion on OpenGL ES profile</div><div class="post-image-white"><a href="./post/0720-skip.png"><img alt="Figure 5: Sample a sRGB texture (with sRGB data) without doing a sRGB to linear RGB conversion" src="./post/0720-crop-skip.png"/></a></div><div class="post-image-title">Figure 5: Sample a sRGB texture (with sRGB data) without doing a sRGB to linear RGB conversion</div><p>
			As a result, a default behavior on ES profile (4) results in a completely wrong output on core profile (3).
		</p><p>
			Intel (with only new drivers) and AMD behave just like NVIDIA except regarding the <span class="codeword">GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</span> query on the default framebuffer: Intel and AMD returns GL_SRGB and NVIDIA returns GL_LINEAR.
		</p><p class="quote">
			IF <span class="codeword">FRAMEBUFFER_BINDING</span> is 0 then if <span class="codeword">FRAMEBUFFER_SRGB</span> is enabled, the R, G, and B values after blending are converted into the non-linear sRGB color space. Otherwise, follow the specification.
		<span class="quote-author">Observed NVIDIA framebuffer sRGB conversion rule on OpenGL core</span></p><p>
			Where NVIDIA behavior has obviously a bug, Intel and AMD behavior might be the result of a specification bug: <a href="https://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt">WGL_framebuffer_sRGB</a> despite being ratified in 2008, never had the luxury to get it's specification written.
		</p><p class="quote">
			21) Where's the specification language for the GLX and WGL pixel format selection interface? 
			TO BE DONE. The <span class="codeword">{GLX,WGL}_FRAMEBUFFER_SRGB_CAPABLE_ARB</span> pixel format attributes are used to select default framebuffers which are sRGB-capable in the fairly obvious way, but this language was missing in the original <span class="codeword">EXT_framebuffer_sRGB</span> and needs to be added here.
		<span class="quote-author"><a href="https://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt">framebuffer_sRGB: issue 21</a></span></p><p>
			With Windows 7, all the default framebuffers are sRGB capable however there is no way to explicitly request a linear or sRGB color encoding. Additionally, maybe the default framebuffer is effectively sRGB however Windows compositor interprets sRGB values as linear RGB values anyway hence producing the result in figure 3 and 5. This would mean that Windows effectively doesn't support sRGB framebuffer natively which would be shocking but not impossible. If someone has information at OS level, I'll enjoy to get some inputs!
		</p><p>
			In any case, we need a proper <span class="codeword"><a href="https://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt">WGL_framebuffer_sRGB</a></span> specification allowing to create a linear RGB or sRGB default framebuffer explicitly but also defining sRGB conversions on the default framebuffer.
		</p><div class="code"><span class="code-title">How to workaround sRGB framebuffer conversions issues on Windows?</span><ul class="code-list"><li class="code-line"><span class="code-line-content"><span class="keyword">void</span> bindFramebuffer(GLuint FramebufferName)</span></li><li class="code-line"><span class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="comment">// ES doesn't have GL_FRAMEBUFFER_SRGB unless <a href="https://www.khronos.org/registry/gles/extensions/EXT/EXT_sRGB_write_control.txt">EXT_sRGB_write_control</a> is supported</span></span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content"><span class="keyword">if</span>(HasFramebufferSRGBEnable)</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">{</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">if</span>(FramebufferName == 0)</span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">glDisable(GL_FRAMEBUFFER_SRGB);</span></li><li class="code-line"><span style="padding-left:64px" class="code-line-content"><span class="keyword">else</span></span></li><li class="code-line"><span style="padding-left:96px" class="code-line-content">glEnable(GL_FRAMEBUFFER_SRGB);</span></li><li class="code-line"><span style="padding-left:32px" class="code-line-content">}</span></li><li class="code-line"><span class="code-line-content">}</span></li></ul></div><p>
			Unfortunately, on MacOSX and at least some AMD drivers there are more problematic cases. For example, it may happen that we must disable framebuffer sRGB conversion on framebuffer object if the attachments are not using a sRGB framebuffer. Furthremore, sRGB conversions are performed on none or all framebuffer attachments for multiple framebuffer attachments case so that all attachments must use the same color space.
		</p><p>
			Considering formats such as <span class="codeword">RGB10A_UNORM</span> or <a href="http://iwasbeingirony.blogspot.jp/2010/06/difference-between-rgbm-and-rgbd.html">RGBD</a> we might wonder if it's worth bothering with sRGB framebuffers.
		</p><h4>OpenGL drivers summary</h4><div class="post-image-white"><a href="./doc/OpenGL%20Drivers%20Status.pdf"><img alt="March 2015 OpenGL samples passing on available implementations" src="./post/0720.png"/></a></div><div class="post-image-title">March 2015 OpenGL samples passing on available implementations</div><div class="post-image-white"><a href="./doc/OpenGL%20Drivers%20Status%202014-07.pdf"><img alt="July 2014 OpenGL samples passing on available implementations" src="./post/0672-1.png"/></a></div><div class="post-image-title">July 2014 OpenGL samples passing on available implementations</div><ul><li><a href="http://opengl.delphigl.de/gl_generatereport.php?reportID=767">glCapsViewer report for AMD Catalyst 15.3 b1</a></li><li><a href="http://opengl.delphigl.de/gl_generatereport.php?reportID=766">glCapsViewer report for Intel HD Graphics 10.18.10.4156</a></li><li><a href="http://opengl.delphigl.de/gl_generatereport.php?reportID=753">glCapsViewer report for NVIDIA Forceware 347.88</a></li><li><a href="project-0026.html#menu">OpenGL Samples Pack <a href="https://sourceforge.net/projects/ogl-samples/files/OpenGL%20Samples%20Pack%204.5.1.0/ogl-samples-4.5.1.0.zip/download">4.5.1.0</a></a>:  (<a href="https://sourceforge.net/projects/ogl-samples/files/OpenGL%20Samples%20Pack%204.5.1.0/ogl-samples-4.5.1.0.zip/download">ZIP, 153.0 MB</a>)  (<a href="https://sourceforge.net/projects/ogl-samples/files/OpenGL%20Samples%20Pack%204.5.1.0/ogl-samples-4.5.1.0.7z/download">7Z, 78.3 MB</a>) </li><li><a href="https://github.com/g-truc/ogl-samples/archive/master.zip">OpenGL Samples Pack staging</a></li><li><a href="https://github.com/g-truc/ogl-samples/issues?state=open">Submit a bug report</a></li></ul></div><h3 xmlns="http://www.w3.org/1999/xhtml" class="share"><a class="" href="http://feeds.feedburner.com/g-truc">RSS Feed</a> ~ Comment: <a class="" href="mailto:mail@g-truc.net?subject=March 2015 OpenGL drivers status and FB sRGB conversions">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a target="_blank" data-via="g_truc" title="Click to share this post on Twitter" class="" href="http://twitter.com/home?status=#g_truc March 2015 OpenGL drivers status and FB sRGB conversions http://www.g-truc.net/post-0720.html">Twitter</a> - <a title="Click to share this post on Facebook" class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0720.html">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0720.html&amp;title=March 2015 OpenGL drivers status and FB sRGB conversions&amp;summary=March 2015 OpenGL drivers status and FB sRGB conversions&amp;source='Christophe Riccio'">Linked In</a> - <a class="" href="https://plusone.google.com/_/+1/confirm?mini=true&amp;url=http://www.g-truc.net/post-0720.html&amp;title=March 2015 OpenGL drivers status and FB sRGB conversions&amp;content=March 2015 OpenGL drivers status and FB sRGB conversions">Google+</a> - <a class="" href="http://www.g-truc.net/post-0720.html">Permanent link</a></h3></content></entry></feed>