<?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>dancrack.com</title>
	<atom:link href="http://dancrack.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dancrack.com</link>
	<description>where I go on about stuff you probably don&#039;t want to know about...</description>
	<lastBuildDate>Sun, 15 May 2011 20:38:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>First Forays into WebGL&#8230; THREE.js</title>
		<link>http://dancrack.com/2011/05/15/first-forays-into-webgl-three-js/</link>
		<comments>http://dancrack.com/2011/05/15/first-forays-into-webgl-three-js/#comments</comments>
		<pubDate>Sun, 15 May 2011 18:27:23 +0000</pubDate>
		<dc:creator>m3tadan</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://dancrack.com/?p=4</guid>
		<description><![CDATA[Right, so I&#8217;ve spent some of this weekend messing around with webgl and canvas etc. I started off reading around and did a little bit of coding, learning how to set up and initialise the canvas renderer, camera, shaders, buffers etc&#8230; and then came across three.js. This awesome library, which is still under development, aims [...]]]></description>
			<content:encoded><![CDATA[<p>Right, so I&#8217;ve spent some of this weekend messing around with webgl and canvas etc.</p>
<p>I started off reading around and did a little bit of coding, learning how to set up and initialise the canvas renderer, camera, shaders, buffers etc&#8230; and then came across <a title="three.js - mrdoob" href="https://github.com/mrdoob/three.js">three.js</a>.</p>
<p>This awesome library, which is still under development, aims to &#8220;create a lightweight 3D engine with a very low level of complexity — in other words, for dummies. The engine can render using &lt;canvas&gt;, &lt;svg&gt; and WebGL.&#8221;. Perfect for me then.</p>
<p>After a bit of playing around with the example <a href="http://www.aerotwist.com/lab/getting-started-with-three-js/">here</a>, I slowly started working on organising the code I was building up into a more usable structure &#8211; it&#8217;s still a right mess, but it&#8217;s an evolving mess.</p>
<p>In the process I also kept trying to add small bits of functionality, some of it taking longer &#8211; and being less productive &#8211; than it could have (like when I first started trying to write my own click detection and then gave up after discovering I should probably be using ?rays? or something &#8211; anyway this is for the next session I figure), some of it coming together surprisingly easily.</p>
<p>So, through these meanderings, I have started getting my head around; keyboard detection ( multiple keys <img src='http://dancrack.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) and interaction, moving objects in a 3d space, mouse click and wheel interaction, lighting, a camera and the beginnings of understandings of meshes/materials, plus probably some more stuff I already can&#8217;t remember.</p>
<p>There was of course a couple of things that set my brain boggling. For instance at one point I tried to start working out how the hell you go about rotating the camera or an object around another object in a 3d space:</p>
<p>So&#8230;   I need to know my position-vector-thing and the point I&#8217;m trying to rotate around&#8217;s position-vector-thing &#8230;</p>
<p>&#8230; and then I need to know how far away from it I am currently and &#8230; er &#8230; should there be an axis involved?</p>
<p>Am I rotating or am I moving and rotating?</p>
<p>Do I need to know where it and I am, in relation to some theoretical centre-point in the environment I&#8217;m working in?</p>
<p>Is my head about to overheat and need me to stick it in the freezer&#8230;</p>
<p>Anyway, obviously there is a way and it must be well documented but at the point it hit me, I decided it too, should be something investigated at a later point.</p>
<p>I found this awesome(seemingly anyway) introduction to the whole concept of graphics programming:</p>
<p><a href="http://www.arcsynthesis.org/gltut/">http://www.arcsynthesis.org/gltut/</a> &#8211; thank you Mr Jason L. McKesson I will be endeavouring to read this as I foray further.</p>
<p>I also managed to remove my old stagnant site and replace it with this new install. I don&#8217;t know whether I&#8217;ll use it much, but we shall see.</p>
<p>Anyway I&#8217;ve gone on enough, here&#8217;s what I ended up with this weekend:</p>
<p><a href="http://dancrack.com/code/webgl/new2.php">WebGL Experiment 1</a></p>
<p><em>A, W, S and D move the current object around (position.x + position.y)<br />
The mouse wheel moves the current object into and out of the space (position.z)<br />
Clicking on the background creates(and sets control too) an object<br />
Clicking the options on the left change what you are in control of at that point in time (Last created Object, Light or Camera).<br />
</em><br />
Have a play&#8230; I know it&#8217;s not that advanced but it&#8217;s been a fun weekend.</p>
<div class="tldr"><span>I played with canvas/webgl for the first time and made this: <a href="http://dancrack.com/code/webgl/new2.php">WebGL Experiment 1</a></span></div>
]]></content:encoded>
			<wfw:commentRss>http://dancrack.com/2011/05/15/first-forays-into-webgl-three-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

