<?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 - Archives</title><subtitle>G-Truc Creation - Archives</subtitle><link href="http://www.g-truc.net/post.atom" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/index.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0743.html</id><updated>2016-04-18T23:30:00.00Z</updated><author><name>Christophe Riccio</name></author><xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><entry><title>Week 1</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0743.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0743.html</id><updated>2016-04-18T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="post-image-black"><a href="./photo/2016-01.jpg"><img alt="" src="./photo/2016-01-960.jpg"/></a></div></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=Week 1">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc Week 1 http://www.g-truc.net/post-0743.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0743.html" title="Click to share this post on Facebook">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0743.html&amp;title=Week 1&amp;summary=Week 1&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-0743.html&amp;title=Week 1&amp;content=Week 1">Google+</a> - <a class="" href="http://www.g-truc.net/post-0743.html">Permanent link</a></h3></content></entry><entry><title>Week 25: Vient, puis s'en va</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0742.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0742.html</id><updated>2015-10-03T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="post-image-black"><a href="./photo/2015-25.jpg"><img alt="" src="./photo/2015-25-960.jpg"/></a></div></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=Week 25: Vient, puis s'en va">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc Week 25: Vient, puis s'en va http://www.g-truc.net/post-0742.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0742.html" title="Click to share this post on Facebook">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0742.html&amp;title=Week 25: Vient, puis s'en va&amp;summary=Week 25: Vient, puis s'en va&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-0742.html&amp;title=Week 25: Vient, puis s'en va&amp;content=Week 25: Vient, puis s'en va">Google+</a> - <a class="" href="http://www.g-truc.net/post-0742.html">Permanent link</a></h3></content></entry><entry><title>OpenGL Samples 4.5.2.0 released</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0741.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0741.html</id><updated>2015-09-22T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><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 class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc OpenGL Samples 4.5.2.0 released http://www.g-truc.net/post-0741.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0741.html" title="Click to share this post on Facebook">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>Week 24: Voyage</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0740.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0740.html</id><updated>2015-09-07T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="post-image-black"><a href="./photo/2015-24.jpg"><img alt="" src="./photo/2015-24-960.jpg"/></a></div></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=Week 24: Voyage">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc Week 24: Voyage http://www.g-truc.net/post-0740.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0740.html" title="Click to share this post on Facebook">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0740.html&amp;title=Week 24: Voyage&amp;summary=Week 24: Voyage&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-0740.html&amp;title=Week 24: Voyage&amp;content=Week 24: Voyage">Google+</a> - <a class="" href="http://www.g-truc.net/post-0740.html">Permanent link</a></h3></content></entry><entry><title>GLM 0.9.7.1 released</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0739.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0739.html</id><updated>2015-09-07T12:00:00.00Z</updated><content type="xhtml" xml:lang="en"><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 class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc GLM 0.9.7.1 released http://www.g-truc.net/post-0739.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0739.html" title="Click to share this post on Facebook">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>Week 23: Underwater golden infinite</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0738.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0738.html</id><updated>2015-09-01T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="post-image-black"><a href="./photo/2015-23.jpg"><img alt="" src="./photo/2015-23-960.jpg"/></a></div></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=Week 23: Underwater golden infinite">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc Week 23: Underwater golden infinite http://www.g-truc.net/post-0738.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0738.html" title="Click to share this post on Facebook">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0738.html&amp;title=Week 23: Underwater golden infinite&amp;summary=Week 23: Underwater golden infinite&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-0738.html&amp;title=Week 23: Underwater golden infinite&amp;content=Week 23: Underwater golden infinite">Google+</a> - <a class="" href="http://www.g-truc.net/post-0738.html">Permanent link</a></h3></content></entry><entry><title>GLI 0.7.0.0 released</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0737.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0737.html</id><updated>2015-09-01T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><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 class="code-line-content" style="padding-left:32px">gli::texture Texture = gli::load(Filename);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">if</span>(Texture.empty())
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">return</span> 0;
			</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">gli::gl GL;</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">
				gli::gl::format <span class="keyword">const</span> Format = GL.translate(Texture.format());
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">GLenum Target = GL.translate(Texture.target());</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">GLuint TextureName = 0;</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">glGenTextures(1, &amp;TextureName);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">glBindTexture(Target, TextureName);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">glTexParameteri(Target, GL_TEXTURE_BASE_LEVEL, 0);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">
				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 class="code-line-content" style="padding-left:32px">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_R, Format.Swizzle[0]);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_G, Format.Swizzle[1]);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">glTexParameteri(Target, GL_TEXTURE_SWIZZLE_B, Format.Swizzle[2]);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">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 class="code-line-content" style="padding-left:32px">
				glm::tvec3&lt;GLsizei&gt; <span class="keyword">const</span> Dimensions(Texture.dimensions());
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">
				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 class="code-line-content" style="padding-left:32px"><span class="keyword">switch</span>(Texture.target())
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">{</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_1D:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">
				glTexStorage1D(Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()), Format.Internal, Dimensions.x);
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_1D_ARRAY:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_2D:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_CUBE:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">glTexStorage2D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()), Format.Internal,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px">Dimensions.x, Texture.target() == gli::TARGET_2D ? Dimensions.y : FaceTotal);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_2D_ARRAY:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_3D:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">case</span> gli::TARGET_CUBE_ARRAY:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">glTexStorage3D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Texture.levels()), Format.Internal,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px">Dimensions.x, Dimensions.y, Texture.target() == gli::TARGET_3D ? Dimensions.z : FaceTotal);</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">default</span>: assert(0); break;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">}</span></li><li class="code-line"><span class="code-line-content"/></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">for</span>(std::size_t Layer = 0; Layer &lt; Texture.layers(); ++Layer)
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">for</span>(std::size_t Face = 0; Face &lt; Texture.faces(); ++Face)
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><span class="keyword">for</span>(std::size_t Level = 0; Level &lt; Texture.levels(); ++Level)
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">{</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">
				GLsizei <span class="keyword">const</span> LayerGL = <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Layer);
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">glm::tvec3&lt;GLsizei&gt; Dimensions(Texture.dimensions(Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">if</span>(gli::is_target_cube(Texture.target()))
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px">
				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 class="code-line-content" style="padding-left:64px"><span class="keyword">switch</span>(Texture.target())
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">{</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_1D:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:128px">glCompressedTexSubImage1D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, Dimensions.x,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Format.Internal, <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.size(Level)),
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">else</span></span></li><li class="code-line"><span class="code-line-content" style="padding-left:128px">glTexSubImage1D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				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 class="code-line-content" style="padding-left:160px">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_1D_ARRAY:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_2D:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_CUBE:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:128px">glCompressedTexSubImage2D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Dimensions.x, Texture.target() == gli::TARGET_1D_ARRAY ? : Dimensions.y,</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Format.Internal, <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.size(Level)),
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">else</span></span></li><li class="code-line"><span class="code-line-content" style="padding-left:128px">glTexSubImage2D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Dimensions.x, Texture.target() == gli::TARGET_1D_ARRAY ? LayerGL : Dimensions.y,</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Format.External, Format.Type, Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">break;</span></span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_2D_ARRAY:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_3D:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">case</span> gli::TARGET_CUBE_ARRAY:
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">if</span>(gli::is_compressed(Texture.format()))
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:128px">glCompressedTexSubImage3D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0, 0,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Dimensions.x, Dimensions.y, Texture.target() == gli::TARGET_3D ? Dimensions.z : LayerGL,</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Format.Internal, <span class="keyword">static_cast</span>&lt;GLsizei&gt;(Texture.size(Level)),
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">else</span></span></li><li class="code-line"><span class="code-line-content" style="padding-left:128px">glTexSubImage3D(</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">
				Target, <span class="keyword">static_cast</span>&lt;GLint&gt;(Level), 0, 0, 0,
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Dimensions.x, Dimensions.y, Texture.target() == gli::TARGET_3D ? Dimensions.z : LayerGL,</span></li><li class="code-line"><span class="code-line-content" style="padding-left:160px">Format.External, Format.Type, Texture.data(Layer, Face, Level));</span></li><li class="code-line"><span class="code-line-content" style="padding-left:96px"><span class="keyword">break</span>;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px"><span class="keyword">default</span>: assert(0); <span class="keyword">break</span>;
			</span></li><li class="code-line"><span class="code-line-content" style="padding-left:64px">}</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px">}</span></li><li class="code-line"><span class="code-line-content" style="padding-left:32px"><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 class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc GLI 0.7.0.0 released http://www.g-truc.net/post-0737.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0737.html" title="Click to share this post on Facebook">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.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0736.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0736.html</id><updated>2015-08-02T12:00:00.00Z</updated><content type="xhtml" xml:lang="en"><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 class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc GLM 0.9.7.0 released http://www.g-truc.net/post-0736.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0736.html" title="Click to share this post on Facebook">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>Week 22: C'est mon ile</title><link href="http://www.g-truc.net/post.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0735.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0735.html</id><updated>2015-07-20T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><div xmlns="http://www.w3.org/1999/xhtml" class="atom-content"><div class="post-image-black"><a href="./photo/2015-22.jpg"><img alt="" src="./photo/2015-22-960.jpg"/></a></div></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=Week 22: C'est mon ile">by email</a> - <a class="" href="http://twitter.com/g_truc">on Twitter</a> ~ Share: <a class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc Week 22: C'est mon ile http://www.g-truc.net/post-0735.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0735.html" title="Click to share this post on Facebook">Facebook</a> - <a class="" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.g-truc.net/post-0735.html&amp;title=Week 22: C'est mon ile&amp;summary=Week 22: C'est mon ile&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-0735.html&amp;title=Week 22: C'est mon ile&amp;content=Week 22: C'est mon ile">Google+</a> - <a class="" href="http://www.g-truc.net/post-0735.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.atom" lang="en" rel="self" type="application/atom+xml"/><link href="http://www.g-truc.net/post-0734.html" lang="en" rel="alternate" type="text/html"/><id>http://www.g-truc.net/post-0734.html</id><updated>2015-07-20T23:30:00.00Z</updated><content type="xhtml" xml:lang="en"><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 class="" data-via="g_truc" href="http://twitter.com/home?status=#g_truc Texture swizzling in OpenGL, OpenGL ES and WebGL http://www.g-truc.net/post-0734.html" target="_blank" title="Click to share this post on Twitter">Twitter</a> - <a class="" href="http://www.facebook.com/share.php?u=http://www.g-truc.net/post-0734.html" title="Click to share this post on Facebook">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></feed>