<?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>A Party to the World &#187; opengl</title>
	<atom:link href="http://dan.lecocq.us/wordpress/tag/opengl/feed/" rel="self" type="application/rss+xml" />
	<link>http://dan.lecocq.us/wordpress</link>
	<description>Life, love, and computer science</description>
	<lastBuildDate>Sun, 25 Jul 2010 16:20:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Triangle Strip for Grids &#8211; A Construction</title>
		<link>http://dan.lecocq.us/wordpress/2009/12/25/triangle-strip-for-grids-a-construction/</link>
		<comments>http://dan.lecocq.us/wordpress/2009/12/25/triangle-strip-for-grids-a-construction/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 09:02:36 +0000</pubDate>
		<dc:creator>dan.lecocq</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[mesh]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[triangle strip]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/?p=791</guid>
		<description><![CDATA[I&#8217;m working with WebGL and as such, I&#8217;m discovering some quirks about OpenGL ES 2.0. I have been using display lists as long as I&#8217;ve been using OpenGL, but WebGL doesn&#8217;t have support for them. So, I&#8217;m buckled down and familiarized myself with vertex buffer objects, the (perhaps better) alternative. At any rate, I need [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working with WebGL and as such, I&#8217;m discovering some quirks about OpenGL ES 2.0.  I have been using display lists as long as I&#8217;ve been using OpenGL, but WebGL doesn&#8217;t have support for them.  So, I&#8217;m buckled down and familiarized myself with vertex buffer objects, the (perhaps better) alternative.</p>
<p>At any rate, I need to render a regular 2D grid, and as it doesn&#8217;t support quads, either, I was forced to use triangles.  In the interest of getting things running, I just provided a wasteful list of discrete triangles.  This is wasteful because it references many more vertices than necessary &#8211; I ended up declaring <img src="http://dan.lecocq.us/wordpress/wp-content/cache/tex_7c692719ce1b4ecd3a0f6128b07e30d4.png" align="absmiddle" class="tex" alt="6n^2" /> vertices when in reality there are only <img src="http://dan.lecocq.us/wordpress/wp-content/cache/tex_86dbfdfcc50f616505123d87957ce5cb.png" align="absmiddle" class="tex" alt="n^2 + n + 1" /> unique vertices.  This worked fine, until I wanted to increase the resolution.  It turns out, JavaScript doesn&#8217;t like large arrays.</p>
<p>That&#8217;s fair, because the implementation was pretty wasteful.  A triangle strip was the best choice anyway.  <strong><em>A triangle strip is a highly compact form of representing a mesh.  For <img src="http://dan.lecocq.us/wordpress/wp-content/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.png" align="absmiddle" class="tex" alt="n" /> triangles, it requires only <img src="http://dan.lecocq.us/wordpress/wp-content/cache/tex_ee380f3087822767aa0e74ac2bfc631b.png" align="absmiddle" class="tex" alt="n + 2" /> vertices defined.</em></strong>  Well, that&#8217;s roughly true.  We&#8217;ll see another case in a minute.  It&#8217;s useful when many triangles share vertices, and perhaps I&#8217;ll let <a href="http://en.wikipedia.org/wiki/Triangle_strip" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Triangle_strip?referer=');">Wikipedia&#8217;s explanation</a> stand.</p>
<p>It wasn&#8217;t immediately obvious how to define a grid out of a single triangle strip and so I got out a pen and paper.  I kept in mind a neat trick: <strong><em>if in a triangle strip, you need to skip the use of a vertex, a vertex can be introduced twice in a row.</em></strong>  That is, if I need triangles (6, 3, 7) and (7, 11, 6) in that order, you can just make your strip with 6, 3, 7, 7, 11, 6.  You can think of it as if there are two triangles created (3, 7, 7) and (7, 7, 11), but they have no area and a degenerate case &#8211; a line.  Furthermore, these lines lie on triangles already defined.</p>
<p>Perhaps the obvious choice doesn&#8217;t yield any results, and in fact in this layout, it can&#8217;t be easily done (you have to have vertices appear three times in a row):</p>
<div id="attachment_792" class="wp-caption aligncenter" style="width: 217px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_bad.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_bad.png" alt="" title="mesh_bad" width="207" height="193" class="size-full wp-image-792" /></a><p class="wp-caption-text">This is a bad idea for a topology if you want to use a single triangle strip.</p></div>
<p>To better convince yourself, try to come up with a good way to put this in a triangle strip.  I&#8217;ll make the case that it is pretty difficult with a claim from graph theory.  In order for a triangle mesh to be turned into a triangle strip, each consecutive triangle must share an edge.  We can then think of the mesh as a connectivity graph (the <a href="http://en.wikipedia.org/wiki/Dual_graph" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Dual_graph?referer=');">dual</a> of the mesh) and then the problem will emerge more clearly:</p>
<div id="attachment_794" class="wp-caption aligncenter" style="width: 217px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_bad_dual.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_bad_dual.png" alt="" title="mesh_bad_dual" width="207" height="193" class="size-full wp-image-794" /></a><p class="wp-caption-text">The dual graph of the bad idea.</p></div>
<p>To make the triangle strip &#8220;nice,&#8221; we ought to be able to visit each node once and exactly once.  There&#8217;s good and bad news in this &#8211; it&#8217;s the same problem as finding a <a href="http://en.wikipedia.org/wiki/Hamiltonian_path" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Hamiltonian_path?referer=');">Hamlitonian path</a> which is NP complete.  The good news is that if we find a solution to our small problem, we&#8217;ve found a solution to all such grids (with arbitrarily many triangles).  Note that we don&#8217;t need an Eulerian path.</p>
<p>If you stare long enough at the above connectivity graph, you&#8217;ll hopefully convince yourself that there&#8217;s no way to traverse it visiting each node once and exactly once.  Go ahead and try &#8211; it&#8217;s pretty infuriating.</p>
<p>Looking at how we would traverse one strip (triangles a, b, c, d, e and f) actually gives us a clue.  A triangular strip for that case would be 0, 4, 1, 5, 2, 6, 3, 7, and happiness ensues and we should move onto the next row.  Unfortunately, in the context of this new row, we&#8217;re starting in a different place (topologically) than we started with the first strip.  Vertex 0 has two connected neighbors in its row &#8211; 1 and 4.  Vertex 7 has three in its row: 6, 10 and 11.  It turns out we can change up the topology to remedy this simply:</p>
<div id="attachment_795" class="wp-caption aligncenter" style="width: 217px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_good.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_good.png" alt="A much better topology for drawing this with a single triangle strip." title="mesh_good" width="207" height="193" class="size-full wp-image-795" /></a><p class="wp-caption-text">A much better topology for drawing this with a single triangle strip.</p></div>
<p>We can also see that this is a much better solution by looking at this new graph&#8217;s dual:</p>
<div id="attachment_796" class="wp-caption aligncenter" style="width: 217px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_good_dual.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/mesh_good_dual.png" alt="" title="mesh_good_dual" width="207" height="193" class="size-full wp-image-796" /></a><p class="wp-caption-text">The dual of the better topological choice.</p></div>
<p>You can probably easily find a Hamlitonian path in this case.  But this still leaves us with how to determine the vertex orderings.  We decided that the first row ought to be 0, 4, 1, 5, 2, 6, 3, 7, but moving on from there we need a bit of &#8220;glue&#8221; to move onto the next row.  We insert 7 again, and then continue on from there: 7, 11, 6, 10, 5, 9, 4, 8.  A bit more glue for the third row: 8, 12, 9, 13, 10, 14, 11, and 15:</p>
<div id="attachment_797" class="wp-caption aligncenter" style="width: 261px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/strip.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/12/strip.png" alt="" title="strip" width="251" height="193" class="size-full wp-image-797" /></a><p class="wp-caption-text">An alternative representation of the vertex ordering</p></div>
<p>Looking at the indices from the first row, starting at 0, we can get the next index by alternately adding 4 and then subtracting 3.  On the next row, we&#8217;ll continue to add 4, but then alternately subtract 5.  The 4 is derived as being the number of vertices on a side (if there are <img src="http://dan.lecocq.us/wordpress/wp-content/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.png" align="absmiddle" class="tex" alt="n" /> divisions, then there are <img src="http://dan.lecocq.us/wordpress/wp-content/cache/tex_40b85027598d87611b1c8d5d11e46812.png" align="absmiddle" class="tex" alt="n+1" /> vertices), and the 3 and 5 are explained by the fact that we need to change columns in the mesh, by one step at a time.</p>
<p>An clean implementation is not trivial, but not extremely difficult.  In terms of results, I can fit more than 4 times as many vertices into the mesh than with a per-triangle implementation.  And to boot, it has cut the work of the vertex shader a great deal.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2009/12/25/triangle-strip-for-grids-a-construction/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Silly Mistakes</title>
		<link>http://dan.lecocq.us/wordpress/2009/12/22/silly-mistakes/</link>
		<comments>http://dan.lecocq.us/wordpress/2009/12/22/silly-mistakes/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 13:33:07 +0000</pubDate>
		<dc:creator>dan.lecocq</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/?p=784</guid>
		<description><![CDATA[Every programmer has had this, or at least I like to think that every programmer has experienced this &#8211; you compile, press &#8220;go,&#8221; and epic failure. And the joy doesn&#8217;t stop there &#8211; then the debugging begins. Occasionally, one encounters a bug that gets the better of them, sometimes for hours, sometimes for days, and [...]]]></description>
			<content:encoded><![CDATA[<p>Every programmer has had this, or at least I like to think that every programmer has experienced this &#8211; you compile, press &#8220;go,&#8221; and epic failure.  And the joy doesn&#8217;t stop there &#8211; then the debugging begins.  Occasionally, one encounters a bug that gets the better of them, sometimes for hours, sometimes for days, and sometimes for <a href="http://en.wikipedia.org/wiki/Pentium_FDIV_bug" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Pentium_FDIV_bug?referer=');">months</a>.</p>
<p>Hairs is pulled, teeth are gnashed, and eyeballs strain, scouring line after line.  You try to convince yourself that your algorithm is correct, and that each line of code is justified.  And yet, it still gets the better of you.</p>
<p>After perhaps eight hours, you swallow your pride, and ask a trusted friend to take a look.  Often the very act of explaining things to another human being is helpful, but sometimes you both have to dig into the code.  Maybe a third friend happens upon the two of you, and joins in.</p>
<p>Then, a light bulb goes off.  If you&#8217;re lucky, it&#8217;s a massive structural change that&#8217;s required, but sometimes, it&#8217;s a single line, or a single word or character, and you suddenly find yourself embarrassed.  But do not be.  Every programmer I&#8217;ve ever met, no matter how qualified has run into these problems.  Still, I find it easy to doubt my competence afterwards.</p>
<p>There are rare and beautiful moments when not only does code compile on the first try, but it runs as expected.  Few and far between, cherish these when they come.</p>
<p>This is all inspired from a recent bug I tracked down.  An embarrassing one.  Sure, had I read the 350 or so pages of the OpenGL ES 2.0 specification, I may have caught it earlier, but this was one of those times when it was a single word that had to change.  <strong>I tell myself that I won&#8217;t keep making these kinds of mistakes, and with each conquered bug I gain a tool, an experience point, and that&#8217;s what makes one&#8217;s craft.</strong></p>
<p>I&#8217;ve looked at the time I spend debugging, and I&#8217;ve noticed that the time it takes to solve a bug can often be reduced by leaving the problem for a bit.  Taking a walk, getting a cup of coffee, or sometimes watching an episode of Arrested Development.  <strong>The desire to find and fix a bug is a siren&#8217;s song &#8211; nearly impossible to walk away from, but often a bad idea.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2009/12/22/silly-mistakes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OpenGLot &#8211; Scalar Fields</title>
		<link>http://dan.lecocq.us/wordpress/2009/11/08/openglot-scalar-fields/</link>
		<comments>http://dan.lecocq.us/wordpress/2009/11/08/openglot-scalar-fields/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 14:22:05 +0000</pubDate>
		<dc:creator>dan.lecocq</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[fragment shader]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[openglot]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/?p=694</guid>
		<description><![CDATA[I&#8217;m working on OpenGLot (my OpenGL plotting library) for a class project, and two of the features I decided to implement were contour lines and scalar fields in 2D. A few days ago I got decent-looking contour lines working and today I got scalar fields implemented with a fragment shader. The programmer using the library [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on OpenGLot (my OpenGL plotting library) for a class project, and two of the features I decided to implement were contour lines and scalar fields in 2D.</p>
<p>A few days ago I got decent-looking contour lines working and today I got scalar fields implemented with a fragment shader.  The programmer using the library can specify a function in the form of a string and have it plotted as a scalar field.  Quickly.  Really quickly.</p>
<p>Modern graphics cards support shaders, which are programs that get run on the graphics card, and in parallel. This is great for algorithms that can be run in isolation (one pixel doesn&#8217;t need to know what the others are doing), which is the case here. OpenGLot generates a fragment shader that colors a single pixel based on the value of the function.  Each of the dozens or hundreds of cores on a GPU runs the same code in parallel for their particular pixel.</p>
<div id="attachment_696" class="wp-caption aligncenter" style="width: 299px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-16.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-16-289x300.png" alt="Contouring for a sinusoidal function with the isovalue 0." title="Picture 16" width="289" height="300" class="size-medium wp-image-696" /></a><p class="wp-caption-text">Contouring for a sinusoidal function with the isovalue 0.</p></div>
<div id="attachment_703" class="wp-caption aligncenter" style="width: 310px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-19.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-19-300x281.png" alt="Here&#039;s a first look at the results (taken moments after this first worked for me).  It&#039;s the same sinusoidal function, and I will be improving upon the color mapping in the coming hours." title="Picture 19" width="300" height="281" class="size-medium wp-image-703" /></a><p class="wp-caption-text">Here's a first look at the results (taken moments after this first worked for me).  It's the same sinusoidal function, and I will be improving upon the color mapping in the coming hours.</p></div>
<p>The graphing program I use, Grapher.app is rapidly showing its age.  The results it gives for the same function (though using a much better coloring scheme) are either grainy or extremely slow (10 or more seconds).  OpenGLot is generating these in less than 0.1 seconds.  (Grapher.app implements its scalar fields on the CPU, so comparing times is a little like comparing apples and oranges.  Still, responsiveness in this type of matter is important.)</p>
<div id="attachment_697" class="wp-caption aligncenter" style="width: 310px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-17.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-17-300x174.png" alt="The quick (and grainy) plot in Grapher.app" title="Picture 17" width="300" height="174" class="size-medium wp-image-697" /></a><p class="wp-caption-text">The quick (and grainy) plot in Grapher.app</p></div>
<div id="attachment_698" class="wp-caption aligncenter" style="width: 310px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-18.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/11/Picture-18-300x174.png" alt="The slow (but smooth) plot in Grapher.app" title="Picture 18" width="300" height="174" class="size-medium wp-image-698" /></a><p class="wp-caption-text">The slow (but smooth) plot in Grapher.app</p></div>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2009/11/08/openglot-scalar-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGLot</title>
		<link>http://dan.lecocq.us/wordpress/2009/10/09/openglot/</link>
		<comments>http://dan.lecocq.us/wordpress/2009/10/09/openglot/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 18:52:10 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[graphing]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[openglot]]></category>
		<category><![CDATA[plotting]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/?p=617</guid>
		<description><![CDATA[As a teaching tool for a course last semester, I put together an interactive plotter in openGL which I endearingly named &#8220;openGLot.&#8221; (For those who missed it, &#8220;openGL&#8221; + &#8220;plot&#8221; = &#8220;openGLot.&#8221;) See, I felt like I had to give it a very unsavory name so that if it ever became widely used, people would [...]]]></description>
			<content:encoded><![CDATA[<p>As a teaching tool for a course last semester, I put together an interactive plotter in openGL which I endearingly named &#8220;openGLot.&#8221; (For those who missed it, &#8220;openGL&#8221; + &#8220;plot&#8221; = &#8220;openGLot.&#8221;)  See, I felt like I had to give it a very unsavory name so that if it ever became widely used, people would be forced to use its ill-sounding moniker.</p>
<p>At any rate, I originally wrote in Ruby, but have been slowly porting it to C++ with high hopes for its use and applicability.  I still have a bunch of interactive demos for numerical methods (from Newton&#8217;s method to the trapezoidal rule for numerical integration) in the Ruby version, but I&#8217;ll be bringing those to the C++ version one of these days.  I started a <a href="https://sourceforge.net/projects/openglot/" onclick="urchinTracker('/outgoing/sourceforge.net/projects/openglot/?referer=');">sourceforge project</a> for it a while ago, which was kind of exciting.</p>
<p>At any rate, as a brief (albeit nerdy) respite from the academic onslaught today, I added a class for parameterized curves.<br />
<div id="attachment_618" class="wp-caption aligncenter" style="width: 299px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/parameterized_curves.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/parameterized_curves-289x300.png" alt="A demo of a parameterized curve in openGLot" title="parameterized_curves" width="289" height="300" class="size-medium wp-image-618" /></a><p class="wp-caption-text">A demo of a parameterized curve in openGLot</p></div></p>
<p>I&#8217;ve got a bunch more primitives to add to it (scalar and vector fields, for example), but those will surely come one of these days.  I&#8217;ve added adaptive mesh refinement (so that &#8220;busier&#8221; functions require more sampling to get a more accurate visual representation), but I&#8217;m still not quite happy with it.<br />
<div id="attachment_619" class="wp-caption aligncenter" style="width: 299px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/with-no-refinement.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/with-no-refinement-289x300.png" alt="A &quot;busy&quot; function with no adaptive refinement" title="with-no-refinement" width="289" height="300" class="size-medium wp-image-619" /></a><p class="wp-caption-text">A &quot;busy&quot; function with no adaptive refinement</p></div></p>
<div id="attachment_620" class="wp-caption aligncenter" style="width: 299px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/with-refinement.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/with-refinement-289x300.png" alt="The same &quot;busy&quot; function with recursive refinement." title="with-refinement" width="289" height="300" class="size-medium wp-image-620" /></a><p class="wp-caption-text">The same &quot;busy&quot; function with recursive refinement.</p></div>
<p>I&#8217;ve also got a 3D version, but that&#8217;s not been polished or formalized, but everyone loves a pretty graph:<br />
<a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/openGLot3D.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2009/10/openGLot3D-300x281.png" alt="openGLot3D" title="openGLot3D" width="300" height="281" class="aligncenter size-medium wp-image-621" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2009/10/09/openglot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chess</title>
		<link>http://dan.lecocq.us/wordpress/2008/12/12/chess/</link>
		<comments>http://dan.lecocq.us/wordpress/2008/12/12/chess/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 07:38:50 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[artificial intelligence]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/?p=212</guid>
		<description><![CDATA[For Artificial Intelligence, in order to satisfy the final project requirement, I wrote a small chess-playing agent. It&#8217;s not horrible, but it&#8217;s not going to win any awards. Still, despite its simplicity, I&#8217;ve noticed that in games against itself, it exhibits some seemingly second-order behaviors, like forks, pins, skewers and so on. I found that [...]]]></description>
			<content:encoded><![CDATA[<p>For Artificial Intelligence, in order to satisfy the final project requirement, I wrote a small chess-playing agent.  It&#8217;s not horrible, but it&#8217;s not going to win any awards.  Still, despite its simplicity, I&#8217;ve noticed that in games against itself, it exhibits some seemingly second-order behaviors, like forks, pins, skewers and so on.  I found that interesting.</p>
<p>I did write a text-based interface for playing against it, but it&#8217;s tedious to actually use, and so, having done well in graphics, I decided to write a simple GUI in OpenGL.  You can click-and-drag your pieces to where you want them, and then wait for the computer to play.  Here&#8217;s a screenshot of a game&#8217;s conclusion:<br />
<div id="attachment_213" class="wp-caption aligncenter" style="width: 310px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/12/board.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/12/board-300x300.png" alt="A game&#039;s conclusion" title="Board" width="300" height="300" class="size-medium wp-image-213" /></a><p class="wp-caption-text">A game's conclusion</p></div></p>
<p>I&#8217;d like to give the piece icons transparency on the border so that you can see the underlying square, but that will be a job for tomorrow.  Even as it is, I&#8217;m pleased with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2008/12/12/chess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphics Project 3</title>
		<link>http://dan.lecocq.us/wordpress/2008/11/01/graphics-project-3/</link>
		<comments>http://dan.lecocq.us/wordpress/2008/11/01/graphics-project-3/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 03:24:41 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[computer science]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[3d modeling]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://dan.lecocq.us/wordpress/?p=129</guid>
		<description><![CDATA[Not long ago we got our third graphics project assigned. In the first we wrote our own raytracer, and in the second we got familiar with OpenGL and implemented a trackball interface that would load a model and allow the user to rotate it around to see it from different angles. This third project deals [...]]]></description>
			<content:encoded><![CDATA[<p>Not long ago we got our third graphics project assigned.  In the first we wrote our own raytracer, and in the second we got familiar with OpenGL and implemented a trackball interface that would load a model and allow the user to rotate it around to see it from different angles.  This third project deals with texturing, however.</p>
<p>The first part was to generate a torus and texture it with a tile-able pattern (we were given a few wood textures and one brick).  Same trackball interface applies.</p>
<div id="attachment_130" class="wp-caption alignnone" style="width: 310px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/brick_torus.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/brick_torus-300x282.png" alt="A torus made of bricks" title="Brick Torus" width="300" height="282" class="size-medium wp-image-130" /></a><p class="wp-caption-text">A torus made of bricks</p></div>
<p>Next up was to add a way to render a model that&#8217;s seemingly made out of mirror, reflecting a virtual environment, provided to us by a teacher.  This one seems to be the inside of a building near a window.</p>
<div id="attachment_131" class="wp-caption alignnone" style="width: 310px"><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/mirror_bunny.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/mirror_bunny-300x282.png" alt="Bunny of mirrors" title="Mirrored Bunny" width="300" height="282" class="size-medium wp-image-131" /></a><p class="wp-caption-text">Bunny of mirrors</p></div>
<p>Lastly, given a 3D texture (marble), we were to &#8220;carve&#8221; a model out of that material.  See Isis and the shark made of marble.</p>
<p><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/marble_isis.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/marble_isis-300x282.png" alt="" title="Marble Isis" width="300" height="282" class="alignnone size-medium wp-image-132" /></a></p>
<p><a href="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/marble_shark.png"><img src="http://dan.lecocq.us/wordpress/wp-content/uploads/2008/11/marble_shark-300x282.png" alt="" title="Marble Shark" width="300" height="282" class="alignnone size-medium wp-image-133" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://dan.lecocq.us/wordpress/2008/11/01/graphics-project-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
