<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Encelo's Blog &#187; PyOpenGL</title>
	<atom:link href="http://encelo.netsons.org/blog/tag/pyopengl/feed/" rel="self" type="application/rss+xml" />
	<link>http://encelo.netsons.org/blog</link>
	<description>When I grow up I want to be a game developer</description>
	<lastBuildDate>Mon, 02 Nov 2009 23:49:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Let there be light!</title>
		<link>http://encelo.netsons.org/blog/2008/04/28/let-there-be-light/</link>
		<comments>http://encelo.netsons.org/blog/2008/04/28/let-there-be-light/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 20:24:12 +0000</pubDate>
		<dc:creator>encelo</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Real-time Graphics]]></category>
		<category><![CDATA[deferred]]></category>
		<category><![CDATA[GLSL]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[PyOpenGL]]></category>
		<category><![CDATA[shaders]]></category>

		<guid isPermaLink="false">http://encelo.netsons.org/blog/?p=62</guid>
		<description><![CDATA[I started exploring deferred shading rendering to display multiple light sources and ended writing a demo featuring eight different lighting techniques and a PyOpenGL class library.  

The whole story is more than a month old, just after releasing the first depth of field demo I began studying deferred shading, but I extended my purpose [...]]]></description>
			<content:encoded><![CDATA[<p>I started exploring deferred shading rendering to display multiple light sources and ended writing a demo featuring eight different lighting techniques and a PyOpenGL class library. <img src='http://encelo.netsons.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img src="/blog/wp-content/uploads/2008/04/glsl_multilight.png" alt="glsl_multilight" /></p>
<p>The whole story is more than a month old, just after releasing the first depth of field demo I began studying deferred shading, but I extended my purpose to include other lighting methods, like single and multi-pass fixed-pipeline lighting, per-vertex and per-pixel single and multi-pass shader lighting and, of course, deferred one.</p>
<p>While writing the C code, I thought it was going to be fun to also port it to Python, this way I could have also have a look to the &#8220;new&#8221; (ArchLinux adopted it quite late <img src='http://encelo.netsons.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) ctypes PyOpenGL, aka PyOpenGL 3.</p>
<p>Unfortunately, many little but annoying issues delayed me until today:</p>
<ul>
<li>not setting explicitely <tt>glDepthFunc(GL_LEQUAL)</tt> (or, alternatively, not clearing the depth buffer at each pass) for multi-pass scene rendering made every pass to be discarded excepting the first one.</li>
<li>trying to make a buggy Python <tt>glDrawBuffers()</tt> wrapper work.<br />
Actually I had no luck with this and give up on MRTs support in PyOpenGL.</li>
<li>trying to figure out why VBOs didn&#8217;t work on PyOpenGL, I give up on this too. <img src='http://encelo.netsons.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>using a uniform variable to index the <tt>gl_LightSource</tt> structure array, which prevented the shader from running on Shader Model 3.0 cards</li>
<li>exploring all the possibilities that could ever lead to &#8220;the brick room is very dark in fixed-pipeline mode&#8221; issue, only to discover today that this was a mere scaled normals problem.<br />
It was easily solved enabling <tt>GL_RESCALE_NORMAL</tt></li>
</ul>
<p>At last I made it, I have made a multi light demo that includes deferred lighting (although very rough and not optimized at all) and shows coherent lighting in all rendering modes.<br />
The PyOpenGL class library almost works, no MRTs and VBOs, but it is functional enough to sport a complete DoF2  and multilight (without deferred mode, which relies on MRTs, of course) demo conversions.</p>
<p>It&#8217;s not a news anymore that you can view it in action on my <a href="http://www.youtube.com/encelo">YouTube Channel</a>, or in a high definition <a href="http://www.vimeo.com/952114">720p version</a> hosted on my <a href="http://www.vimeo.com/encelo">Vimeo page</a>.</p>
<p>All&#8217;s well that ends well. <img src='http://encelo.netsons.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://encelo.netsons.org/blog/2008/04/28/let-there-be-light/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
