<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Andor Salga</title>
	<atom:link href="http://asalga.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://asalga.wordpress.com</link>
	<description>A journey into recursive dreams</description>
	<lastBuildDate>Fri, 27 Jan 2012 08:44:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='asalga.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/fd8e04d10e2b1b6b2ad228a4695e395b?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Andor Salga</title>
		<link>http://asalga.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://asalga.wordpress.com/osd.xml" title="Andor Salga" />
	<atom:link rel='hub' href='http://asalga.wordpress.com/?pushpress=hub'/>
		<item>
		<title>No Comply Game Prototype with Processing</title>
		<link>http://asalga.wordpress.com/2012/01/25/no-comply-game-prototype-with-processing/</link>
		<comments>http://asalga.wordpress.com/2012/01/25/no-comply-game-prototype-with-processing/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 21:10:37 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Gladius]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2655</guid>
		<description><![CDATA[Last week I met with Dave Humphrey and Jon Buckley to discuss creating a game for the HTML5 games week which will take place at Mozilla&#8217;s Toronto office in mid-February. The main purpose of this is to drive the development and showcase the Gladius game engine. At the end of the meeting we decided it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2655&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week I met with <a href="http://vocamus.net/dave/">Dave Humphrey</a> and <a href="http://jbuckley.ca/">Jon Buckley</a> to discuss creating a game for the <a href="https://wiki.mozilla.org/HTML5_Games/Work_Week">HTML5 games week</a> which will take place at Mozilla&#8217;s Toronto office in mid-February. The main purpose of this is to drive the development and showcase the <a href="https://github.com/alankligman/gladius">Gladius</a> game engine.</p>
<p>At the end of the meeting we decided it would make the most sense to upgrade the <a href="https://developer.mozilla.org/en-US/demos/detail/no-comply/launch">No Comply demo</a> by adding interaction—making a small game. Since we only have a few weeks, we decided to keep it simple. Keeping that in mind I created a game <a href="http://etherpad.mozilla.org/CjTStOjUgj">specification</a>.</p>
<h2>Play Analysis</h2>
<p>After putting together the spec, I started on a prototype. I began the prototype by playing and analyzing the game mechanics of Mortal Kombat I. The game is simple enough to emulate given the time frame. I took some notes and concluded characters always appear to be in discrete states. If characters are in a particular state, they may or may not be able to transition into another state. Initially a player is idle. From there, they can transition into a jumping. Once jumping they cannot block, but are allowed to punch an kick. Having understood the basic rules, I drew a diagram to visually represent some states.</p>
<p><a href="http://asalga.files.wordpress.com/2012/01/fighting-game-states4.png"><img src="http://asalga.files.wordpress.com/2012/01/fighting-game-states4.png?w=460&#038;h=313" alt="" title="fighting game states" width="460" height="313" class="alignnone size-full wp-image-2663" /></a></p>
<p>The diagram led me to believe I could use the <a href="http://en.wikipedia.org/wiki/State_pattern">state pattern</a> to keep the game extensible. We can get a basic game working and the design should lend itself to later (painless) modification. </p>
<h2>Prototyping the Prototype</h2>
<p>Having worked with <a href="http://processing.org">Processing</a> for some time I knew it would be an ideal tool to construct a prototype of the game. Processing enables developers to get graphical interactive software up and running quickly and easily. The structure is elegant and the language inherits Java&#8217;s simple object-oriented syntax.</p>
<p>I began creating a Processing sketch by adding the necessary classes for player states such as moving, jumping and punching. I hooked in keyboard input to allow changing states and rendered text to indicate the current state. I was able to fix most of the bugs by playing around with different key combinations and just looking at the text output.</p>
<p>I eventually added graphical content, but intentionally kept it crappy. I resisted the urge to create attractive assets since they would be replaced with the No Comply sprites anyway. Neglecting the aesthetics was a challenge—if you cringe at the graphics, I succeeded.</p>
<p>Okay, still <a href="http://142.204.133.22/~asalga/NoComplyProto/">want to play it</a>?<br />
<a href="http://142.204.133.22/~asalga/NoComplyProto/"><img src="http://asalga.files.wordpress.com/2012/01/processing-game-prototype.jpg?w=460" alt="" title="Processing game prototype"   class="alignnone size-full wp-image-2671" /></a></p>
<h2>Next Steps</h2>
<p>I omitted collision detection and some simple game logic from the prototype, but I believe it demonstrates we can create a structure good enough for a fighting game for Gladius. Today I&#8217;ll be switching gears and starting to hack on Gladius to get COLLADA importing working which we&#8217;ll discuss in a Paladin meeting early next week.</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/game-development/'>Game Development</a>, <a href='http://asalga.wordpress.com/category/gladius/'>Gladius</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>, <a href='http://asalga.wordpress.com/category/programming/processing/'>Processing</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2655/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2655/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2655/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2655&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2012/01/25/no-comply-game-prototype-with-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2012/01/fighting-game-states4.png" medium="image">
			<media:title type="html">fighting game states</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2012/01/processing-game-prototype.jpg" medium="image">
			<media:title type="html">Processing game prototype</media:title>
		</media:content>
	</item>
		<item>
		<title>Learning to Wield and Forge Gladius</title>
		<link>http://asalga.wordpress.com/2012/01/23/learning-to-wield-and-forge-gladius/</link>
		<comments>http://asalga.wordpress.com/2012/01/23/learning-to-wield-and-forge-gladius/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 18:32:06 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Gladius]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2633</guid>
		<description><![CDATA[Wielding For the next few weeks I&#8217;ll be working on the open source project Gladius. More specifically, I&#8217;ll be working on CubicVR.js, a rendering engine which is one part of the Gladius 3D game engine. Gladius in turn is part of Paladin, Mozilla&#8217;s initiative to bring awesome gaming technologies to the Web. Since Gladius is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2633&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Wielding</h2>
<p>For the next few weeks I&#8217;ll be working on the open source project <a href="https://github.com/alankligman/gladius">Gladius</a>. More specifically, I&#8217;ll be working on <a href="https://github.com/cjcliffe/CubicVR.js/wiki/Examples-and-Demos">CubicVR.js</a>, a rendering engine which is one part of the Gladius 3D game engine. Gladius in turn is part of <a href="https://wiki.mozilla.org/Paladin">Paladin</a>, Mozilla&#8217;s initiative to bring awesome gaming technologies to the Web.</p>
<p>Since Gladius is a game engine, it is essentially a conglomeration of many game-related technologies:</p>
<h4>Drawing Stuff</h4>
<p>CubicVR.js is a JavaScript port of <a href="https://twitter.com/ccliffe">Charles Cliffe&#8217;s</a> <a href="http://www.cubicvr.org/">CubicVR</a> game engine which is responsible for rendering using <a href="http://www.khronos.org/webgl/">WebGL</a>.</p>
<h4>Saving Stuff</h4>
<p><a href="http://github.com/mozilla/gamesaver">GameSaver</a> is a project which uses Node.js and BrowserID to save JSON game state on a server. Check out a prototype which uses GameSaver at <a href="http://MyFavoriteBeer.org/">MyFavoriteBeer.org</a>.</p>
<h4>Physics Stuff</h4>
<p>For collision detection and response, Gladius uses <a href="https://github.com/kripken/ammo.js">AMMO.js</a>: a JavaScript port of the C++ Bullet physics engine.</p>
<h4>Controlling Stuff</h4>
<p>My supervisor, <a href="http://vocamus.net/dave/">David Humphrey</a> and colleagues in my lab have been working on two important aspects of game input: the <a href="http://wiki.mozilla.org/GamepadAPI">Gamepad API</a> and the <a href="http://developer.mozilla.org/en/API/Mouse_Lock_API">Mouse Lock API</a>. Check them out, they&#8217;re very interesting.</p>
<h4>Other Stuff</h4>
<p>This list is not exhaustive. As the project matures it is expected other libraries and technologies will be incorporated.</p>
<h4>Forging</h4>
<p>The release date for Gladius 0.1 is mid February, so I&#8217;ll be contributing where I can to help out with the release. Last week I started by making a <a href="https://github.com/cjcliffe/CubicVR.js/pull/67">minor tweak</a> to CubicVR.js. Not much, but it&#8217;s a start. I also noticed there wasn&#8217;t a way for developers to simply check for AABB-AABB intersection. So I filed the issue and began working on that as well. This week I&#8217;ll be working with <a href="http://robothaus.org/secretrobotron/">Bobby Richter</a> to fix COLLADA related bugs which is super exciting. (:</p>
<p>Do you want to get involved? You can find a number of ways to get in contact with developers and start contributing <a href="https://wiki.mozilla.org/Paladin/Get_Involved">right here</a>.</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/game-development/'>Game Development</a>, <a href='http://asalga.wordpress.com/category/gladius/'>Gladius</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2633/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2633/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2633/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2633&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2012/01/23/learning-to-wield-and-forge-gladius/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>
	</item>
		<item>
		<title>Extending Processing.js with a OBJ Importer Part 4</title>
		<link>http://asalga.wordpress.com/2012/01/05/extending-processing-js-with-a-obj-importer-part-4/</link>
		<comments>http://asalga.wordpress.com/2012/01/05/extending-processing-js-with-a-obj-importer-part-4/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 05:18:05 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Processing.js]]></category>
		<category><![CDATA[Processing.js OBJ Support]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2609</guid>
		<description><![CDATA[Run Me! This sketch demonstrates more .obj file support for Processing.js. This blog post is the continuation of a series of blogs [1, 2, 3] related to adding .obj file support to Processing.js. This code I&#8217;m working on is important since it will allow developers to easily load 3D models from files and it will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2609&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://matrix.senecac.on.ca/~asalga/pjswebide/index.php?sketchID=58">Run Me!</a><br />
<a href="http://matrix.senecac.on.ca/~asalga/pjswebide/index.php?sketchID=58"><img src="http://asalga.files.wordpress.com/2012/01/star-wars-webgl.png?w=460" alt="" title="star wars webgl"   class="alignnone size-full wp-image-2610" /></a><br />
This sketch demonstrates more .obj file support for Processing.js.</p>
<p>This blog post is the continuation of a series of blogs [<a href="http://asalga.wordpress.com/2011/02/27/extending-processing-js-with-a-obj-importer/">1,</a> <a href="http://asalga.wordpress.com/2011/02/28/extending-processing-js-with-a-obj-importer-part-2/">2</a>, <a href="http://asalga.wordpress.com/2011/09/29/extending-processing-js-with-a-obj-importer-part-3/">3</a>] related to adding .obj file support to <a href="http://www.processingjs.org/">Processing.js</a>. This code I&#8217;m working on is important since it will allow developers to easily load 3D models from files and it will increase the performance of rendering 3D objects in Processing.js.</p>
<p>Since my <a href="http://asalga.wordpress.com/2011/09/29/extending-processing-js-with-a-obj-importer-part-3/">last blog</a>, I have added some small but critical changes to the code, some of which I outline here.</p>
<h2>Interface Change</h2>
<p>I contacted one of the developers of <a href="http://www.processing.org/">Processing</a>, <a href="http://codeanticode.wordpress.com/">Andrés Colubri</a>, who is reworking most of the OpenGL code. Some of his rework includes making <a href="http://code.google.com/p/saitoobjloader/">Saito&#8217;s .obj loader</a> native in Processing. This is great for Processing, but it means that all the time I spent making the Processing.js .obj loader work like Saito&#8217;s was wasted ): On the other hand, it means that pushing this code in the next release of Processing.js might actually be done! (:</p>
<p>The sketch below is a simple example of using Saito&#8217;s .obj extension, which my code expected.<br />
<pre class="brush: java;">
OBJModel obj;

void setup(){
  size(100, 100, 3D);
  obj = new OBJModel();
  obj.load(&quot;object.obj&quot;);
}

void draw(){
  obj.drawMode(POLYGON);
}
</pre></p>
<p>The problem was that I had no idea what loading 3D models was supposed to look like natively. So I asked Andréas for a simple sketch that worked in Processing and that I could emulate in Processing.js.</p>
<p>After receiving the sketch, I was glad to see it wasn&#8217;t much different.<br />
<pre class="brush: java;">
PShape obj;

void setup() {
  size(100, 100, 3D);
  obj = loadShape(&quot;object.obj&quot;);
}

void draw() {    
  shape(obj);
}
</pre></p>
<p>I was able to quickly add a few hacks to make Processing.js work with the new interface. I didn&#8217;t want to rewrite my entire parser just yet since all my tests rely on the old method. I also don&#8217;t want to rewrite my code a third time (:</p>
<h2>Triangulation</h2>
<p>I found that many 3D authoring tools export .obj models with triangle fans. In my <a href="http://asalga.wordpress.com/2011/09/29/extending-processing-js-with-a-obj-importer-part-3/">last blog about .obj importing</a> I wrote about the lack of support in my code for this scenario, but I recently wrote a patch that fixes the issue. It was not difficult to write, but because of this fix, many more models can now be properly parsed. This includes the 3D model at the top of this post.</p>
<h2>Testing, testing, &#8230;</h2>
<p>I found a few more issues with the parser so I fixed them and added reference tests. I&#8217;m finding these tests invaluable since I&#8217;m often tweaking the parser as I go. I have just over 30 right now, but I hope to have many more since I expect the code will go through many more transformations.<br />
<a href="http://asalga.files.wordpress.com/2012/01/obj-loader-ref-test.png"><img src="http://asalga.files.wordpress.com/2012/01/obj-loader-ref-test.png?w=460&#038;h=366" alt="" title="obj loader ref test" width="460" height="366" class="alignnone size-full wp-image-2613" /></a></p>
<h2>Feedback</h2>
<p>If you are using my &#8216;extension&#8217; and you find a file that isn&#8217;t being properly loaded, please send me your file so that I can fix it and add a test.</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>, <a href='http://asalga.wordpress.com/category/programming/processing/'>Processing</a>, <a href='http://asalga.wordpress.com/category/programming/processing-js/'>Processing.js</a>, <a href='http://asalga.wordpress.com/category/processing-js-obj-support/'>Processing.js OBJ Support</a>, <a href='http://asalga.wordpress.com/category/programming/webgl/'>webgl</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2609/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2609/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2609/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2609&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2012/01/05/extending-processing-js-with-a-obj-importer-part-4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2012/01/star-wars-webgl.png" medium="image">
			<media:title type="html">star wars webgl</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2012/01/obj-loader-ref-test.png" medium="image">
			<media:title type="html">obj loader ref test</media:title>
		</media:content>
	</item>
		<item>
		<title>Shadows in WebGL Part 1</title>
		<link>http://asalga.wordpress.com/2011/12/12/shadows-in-webgl-part-1/</link>
		<comments>http://asalga.wordpress.com/2011/12/12/shadows-in-webgl-part-1/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:59:24 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[FSOSS]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[point cloud]]></category>
		<category><![CDATA[webgl]]></category>
		<category><![CDATA[XB PointStream]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2518</guid>
		<description><![CDATA[RUN ME! In my last blog I wrote about an anaglyph demo I created for my FSOSS presentation in October. It was part of a series of delayed blogs which I only recently had time to write up. So, in this blog I&#8217;ll be proceeding with my next fun experiment: Shadows in WebGL. Shadows are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2518&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://scotland.proximity.on.ca/asalga/demos/shadow_vertex_proj/">RUN ME!</a><br />
<a href="http://scotland.proximity.on.ca/asalga/demos/shadow_vertex_proj/"><img src="http://asalga.files.wordpress.com/2011/12/vertex_proj1.jpg?w=460" alt="" title="vertex_proj"   class="alignnone size-full wp-image-2555" /></a></p>
<p>In my <a href="http://asalga.wordpress.com/2011/11/18/anaglyph-point-clouds/">last blog</a> I wrote about an anaglyph demo I created for <a href="http://fsoss.senecac.on.ca/2011/node/95">my FSOSS presentation</a> in October. It was part of a series of delayed blogs which I only recently had time to write up. So, in this blog I&#8217;ll be proceeding with my next fun experiment: Shadows in <a href="http://en.wikipedia.org/wiki/WebGL">WebGL</a>.</p>
<p>Shadows are useful since they not only add realism, but can also provide additional visual cues in a scene. Having never implemented any type of shadows, I started by performing some preliminary research and found that there are numerous methods to achieve this effect. Some of the more common techniques include:</p>
<ul>
<li>vertex projection</li>
<li>projected planar shadows</li>
<li>shadow mapping</li>
<li>shadow volumes</li>
</ul>
<p>I chose vertex projection since it seemed very straightforward. After a few sketches, I got a fairly good grasp of the idea. Given the position for a light and vertex, the shadow cast (for that vertex) will appear at the line intersection between the slope created by those points and the x-intercept. If we had the following values:</p>
<ul>
<li>Light = [4, 4]</li>
<li>Vertex = [1, 2]</li>
</ul>
<p><img src="http://asalga.files.wordpress.com/2011/12/graph_shadow1.jpg?w=460" alt="" title="graph_shadow"   class="alignnone size-full wp-image-2562" /><br />
Our shadow would be drawn at [-2, 0]. Note that the y component is zero and would be equal to zero for all other vertices since we&#8217;re concentrating on planar shadows.</p>
<p>At this point, I understood the problem well; I  just needed a simple formula to get this result. If you run a search for &#8220;vertex projection&#8221; and &#8220;shadows&#8221; you&#8217;ll find a <a href="http://archive.gamedev.net/archive/reference/programming/features/shadows/page2.html">snippet of code</a> on GameDev.net which provides the formula for calculating the x and z components of the shadow. But if you actually try it for the x component:</p>
<p><img src='http://s0.wp.com/latex.php?latex=Sx+%3D+Vx+-+%5Cfrac%7BVy%7D%7BLy%7D+-+Lx&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='Sx = Vx - &#92;frac{Vy}{Ly} - Lx' title='Sx = Vx - &#92;frac{Vy}{Ly} - Lx' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=Sx+%3D+1+-+%5Cfrac%7B2%7D%7B4%7D+-+4&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='Sx = 1 - &#92;frac{2}{4} - 4' title='Sx = 1 - &#92;frac{2}{4} - 4' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=Sx+%3D-3.5&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='Sx =-3.5' title='Sx =-3.5' class='latex' /></p>
<p>It doesn&#8217;t work.</p>
<p>When I ran into this, I had to take a step back to think about the problem and review my graphs. I was convinced that I could contrive a working formula that would be just as simple as the one above. So I conducted additional research until I eventually found the point-slope equation of a line.</p>
<h2>Point-Slope Equation</h2>
<p>The point-slope equation of a line is useful for determining a single point on the slope give the slope and another point on the line. This is exactly the scenario we have!</p>
<p><img src='http://s0.wp.com/latex.php?latex=y+-+y1+%3D+m%28x+-+x1%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='y - y1 = m(x - x1)' title='y - y1 = m(x - x1)' class='latex' /></p>
<p>Where:<br />
<b>m</b> &#8211; The slope. This is known since we have two given points on the line: the vertex and the light.</p>
<p>[<b>x1</b>, <b>y1</b>] &#8211; A known point on the line. In this case: the light.</p>
<p>[<b>x</b>, <b>y</b>] &#8211; Another point on the line which we&#8217;re trying to figure out: the shadow.</p>
<p>Since the final 3D shadow will lie on the xz-plane, the y components will always be zero. We can therefore remove that variable which gives us:</p>
<p><img src='http://s0.wp.com/latex.php?latex=-y1+%3D+m%28x+-+x1%29&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='-y1 = m(x - x1)' title='-y1 = m(x - x1)' class='latex' /></p>
<p>Now that the only unknown is x, we can start isolating it by dividing both sides by the slope:<br />
<img src='http://s0.wp.com/latex.php?latex=-%5Cfrac%7By1%7D%7Bm%7D+%3D+%5Cfrac%7Bm%28x+-+x1%29%7D%7Bm%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='-&#92;frac{y1}{m} = &#92;frac{m(x - x1)}{m}' title='-&#92;frac{y1}{m} = &#92;frac{m(x - x1)}{m}' class='latex' /></p>
<p>Which gives us:<br />
<img src='http://s0.wp.com/latex.php?latex=-%5Cfrac%7By1%7D%7Bm%7D+%3D+x+-+x1&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='-&#92;frac{y1}{m} = x - x1' title='-&#92;frac{y1}{m} = x - x1' class='latex' /></p>
<p>And after rearranging we get our new formula, but is it sound?<br />
<img src='http://s0.wp.com/latex.php?latex=x+%3D+x1+-+%5Cfrac%7By1%7D%7Bm%7D&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x = x1 - &#92;frac{y1}{m}' title='x = x1 - &#92;frac{y1}{m}' class='latex' /></p>
<p>If we use the same values as above as a test:<br />
<img src='http://s0.wp.com/latex.php?latex=x+%3D+4+-+%5Cfrac%7B4%7D%7B%5Cfrac%7B2%7D%7B3%7D%7D&amp;bg=ffffff&amp;fg=666666&amp;s=24' alt='x = 4 - &#92;frac{4}{&#92;frac{2}{3}}' title='x = 4 - &#92;frac{4}{&#92;frac{2}{3}}' class='latex' /><br />
<img src='http://s0.wp.com/latex.php?latex=x+%3D+-2&amp;bg=ffffff&amp;fg=666666&amp;s=0' alt='x = -2' title='x = -2' class='latex' /></p>
<p>It works!</p>
<p>I now had a way to get the x component for the shadow, but what about the z component? What I did so far was create a solution for shadows in 2 dimensions. But if you think about it, both components can be broken down into 2 2D problems. We just need to use the z components for the light and point to get the z component of the shadow.</p>
<h2>Shader Shadows</h2>
<p>The shader code is a bit verbose, but at the same time, very easy to understand:</p>
<p><pre class="brush: cpp;">
void drawShadow(in vec3 l, in vec4 v){
  // Calculate slope.
  float slopeX = (l.y-v.y)/(l.x-v.x);
  float slopeZ = (l.y-v.y)/(l.z-v.z); 

  // Flatten by making all the y components the same.
  v.y = 0.0;
  v.x = l.x - (l.y / slopeX);
  v.z = l.z - (l.y / slopeZ);

  gl_Position = pMatrix * mVMatrix * v;
  frontColor = vec4(0.0, 0.0, 0.0, 1.0);
}
</pre></p>
<h2>Double Trouble</h2>
<p>The technique works, but its major issue is that objects need to be drawn twice. Since I&#8217;m using this technique for dense point clouds, it significantly affects performance. The graph below shows the crippling effects of rendering the shadow of a cloud consisting of 1.5 million points—performance is cut is half.</p>
<p><img src="http://asalga.files.wordpress.com/2011/12/planar-shadows-slow.png?w=460&#038;h=169" alt="" title="planar shadows slow" width="460" height="169" class="alignnone size-full wp-image-2590" /></p>
<p>Fortunately, this problem isn&#8217;t difficult to address. Since detail is not an important property for shadows, we can simply render the object with a lower level of detail. I had already written a <a href="https://github.com/asalga/XB-PointStream/blob/staged/tools/lod.py">level of detail python script</a> which evenly distributes a cloud between multiple files. This script was used to produce a sparse cloud—about 10% of the original.</p>
<p><img src="http://asalga.files.wordpress.com/2011/12/planar-shadows-fast.png?w=460&#038;h=172" alt="" title="planar shadows fast" width="460" height="172" class="alignnone size-full wp-image-2591" /></p>
<h2>Matrix Trick</h2>
<p>It turns out that planar shadows can be alternatively rendered using a simple matrix.</p>
<p><pre class="brush: cpp;">
void drawShadow(in vec3 l, in vec4 v){
  // Projected planar shadow matrix.
  mat4 sMatrix = mat4 ( l.y,  0.0,  0.0,  0.0, 
                       -l.x,  0.0, -l.z, -1.0,
                        0.0,  0.0,  l.y,  0.0,
                        0.0,  0.0,  0.0,  l.y);

  gl_Position = pMatrix * mVMatrix * sMatrix * v;
  frontColor = vec4(0.0, 0.0, 0.0, 1.0);
}
</pre></p>
<p>This method doesn&#8217;t offer any performance increase versus vertex projection, but the code <i>is</i> quite terse. More importantly, using a matrix opens up the potential for drawing shadows on <i>arbitrary</i> planes. This is done by modifying all the elements of the above matrix.</p>
<h2>Future Work</h2>
<p>Sometime in the future I&#8217;d like to experiment with implementing shadows for arbitrary planes. After that I can begin investigating other techniques such as shadow mapping and shadow volumes. Exciting! (:</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/fsoss/'>FSOSS</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>, <a href='http://asalga.wordpress.com/category/point-cloud/'>point cloud</a>, <a href='http://asalga.wordpress.com/category/programming/webgl/'>webgl</a>, <a href='http://asalga.wordpress.com/category/xb-pointstream/'>XB PointStream</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2518/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2518/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2518/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2518&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/12/12/shadows-in-webgl-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/12/vertex_proj1.jpg" medium="image">
			<media:title type="html">vertex_proj</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/12/graph_shadow1.jpg" medium="image">
			<media:title type="html">graph_shadow</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/12/planar-shadows-slow.png" medium="image">
			<media:title type="html">planar shadows slow</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/12/planar-shadows-fast.png" medium="image">
			<media:title type="html">planar shadows fast</media:title>
		</media:content>
	</item>
		<item>
		<title>Anaglyph Point Clouds</title>
		<link>http://asalga.wordpress.com/2011/11/18/anaglyph-point-clouds/</link>
		<comments>http://asalga.wordpress.com/2011/11/18/anaglyph-point-clouds/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 04:22:21 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[FSOSS]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[point cloud]]></category>
		<category><![CDATA[webgl]]></category>
		<category><![CDATA[XB PointStream]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2497</guid>
		<description><![CDATA[See me in 3D! A couple of weeks ago I gave a talk at FSOSS on XB PointStream. For my presentation I wanted to experiment and see what interesting demos I could put together using point clouds. I managed to get a few decent demos complete, but I didn&#8217;t have a chance to blog about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2497&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://scotland.proximity.on.ca/asalga/demos/anaglyph/"><img src="http://asalga.files.wordpress.com/2011/11/anaglyph2.png?w=300&#038;h=196" alt="" title="anaglyph" width="300" height="196" class="alignnone size-medium wp-image-2500" /></a><br />
<a href="http://scotland.proximity.on.ca/asalga/demos/anaglyph/">See me in 3D!</a></p>
<p>A couple of weeks ago I gave a talk at <a href="http://fsoss.senecac.on.ca/2011/">FSOSS</a> on <a href="http://zenit.senecac.on.ca/wiki/index.php/XB_PointStream">XB PointStream</a>. For my presentation I wanted to experiment and see what interesting demos I could put together using point clouds. I managed to get a few decent demos complete, but I didn&#8217;t have a chance to blog about them at the time. So I&#8217;ll be blogging about them piecemeal for the rest of the month.</p>
<p>The first demo I have is an anaglyph rendering. Anaglyphs are one way to give 2D images a depth component. The same object is rendered at two slightly different perspectives using two different colors. Typically red and cyan (blue+green) are used. </p>
<p>The user wears anaglyph glasses, which have filters for both colours. A common standard is to use a red filter for the left eye and a blue filter for the right eye. These filters ensure each eye only sees one of the superimposed perspectives. The mind them merges these two images into a single 3D object.</p>
<h4>Method</h4>
<p>There are many ways to achieve this effect. One method which involves creating two asymmetric frustums can be found <a href="http://quiescentspark.blogspot.com/2011/05/rendering-3d-anaglyph-in-opengl.html">here</a>. However, you can also create the effect by simply rotating or translating the object. It isn&#8217;t as accurate, but it&#8217;s very easy to implement:</p>
<p><pre class="brush: jscript;">
// ps is the instance of XB PointStream
// ctx is the WebGL context

ps.pushMatrix();
// Yaw camera slightly for a different perspective
cam.yaw(0.005);
// Create a lookAt matrix. Apply it to our model view matrix.
ps.multMatrix(M4x4.makeLookAt(cam.pos, V3.add(cam.pos, cam.dir), cam.up));   
 
// Render the object as cyan by using a colour mask.
ctx.colorMask(0,1,1,1);
ps.render(pointCloud);
ps.popMatrix();
  
// Preserve the colour buffer but clear the depth buffer
// so subsequent points are drawn over the previous points.
ctx.clear(ctx.DEPTH_BUFFER_BIT);

ps.pushMatrix();
// Restore the camera's position for the other perspective.
cam.yaw(-0.005);
ps.multMatrix(M4x4.makeLookAt(cam.pos, V3.add(cam.pos, cam.dir), cam.up));   

// Render the object as red by using a colour mask.
ctx.colorMask(1,0,0,1);
ps.render(pointCloud);
ps.popMatrix();
</pre></p>
<h4>Future Work</h4>
<p>I hacked together the demo just in time for my talk at FSOSS, but I was left wondering how much better the effect would look if I had created two separate frustums instead. For this I would need to expose a frustum() method for the library. I can&#8217;t see a reason not to add it considering this is a perfect use case, so <a href="http://cdot.lighthouseapp.com/projects/52886-xb-pointstream/tickets/184-add-frustum-method">filed</a>!</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/fsoss/'>FSOSS</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>, <a href='http://asalga.wordpress.com/category/point-cloud/'>point cloud</a>, <a href='http://asalga.wordpress.com/category/programming/webgl/'>webgl</a>, <a href='http://asalga.wordpress.com/category/xb-pointstream/'>XB PointStream</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2497/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2497&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/11/18/anaglyph-point-clouds/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/11/anaglyph2.png?w=300" medium="image">
			<media:title type="html">anaglyph</media:title>
		</media:content>
	</item>
		<item>
		<title>XB Awesome at FSOSS 2011</title>
		<link>http://asalga.wordpress.com/2011/10/28/xb-awesome-at-fsoss-2011/</link>
		<comments>http://asalga.wordpress.com/2011/10/28/xb-awesome-at-fsoss-2011/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 04:05:05 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Arius3D]]></category>
		<category><![CDATA[FSOSS]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[point cloud]]></category>
		<category><![CDATA[webgl]]></category>
		<category><![CDATA[XB PointStream]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2485</guid>
		<description><![CDATA[Tomorrow I&#8217;ll be giving a talk at FSOSS 2011 titled &#8220;XB PointStream: Rendering Point Clouds with WebGL&#8221;. Okay, the name is a bit dry, but I&#8217;ve packed a lot of awesome into this talk. If you liked my recent post on turbulent point clouds, you should definitely come to my talk! (: I&#8217;ll be in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2485&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Tomorrow I&#8217;ll be giving a talk at <a href="http://fsoss.senecac.on.ca/2011/">FSOSS 2011</a> titled <a href="http://fsoss.senecac.on.ca/2011/node/95">&#8220;XB PointStream: Rendering Point Clouds with WebGL&#8221;</a>. Okay, the name is a bit dry, but I&#8217;ve packed a lot of awesome into this talk. If you liked <a href="http://asalga.wordpress.com/2011/10/24/fixing-ro-mes-turbulent-point-cloud/">my recent post on turbulent point clouds</a>, you should definitely come to my talk! (:</p>
<p>I&#8217;ll be in room <b>S2169 at 2:00</b>, hope to see you there!</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/arius3d/'>Arius3D</a>, <a href='http://asalga.wordpress.com/category/fsoss/'>FSOSS</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>, <a href='http://asalga.wordpress.com/category/point-cloud/'>point cloud</a>, <a href='http://asalga.wordpress.com/category/programming/webgl/'>webgl</a>, <a href='http://asalga.wordpress.com/category/xb-pointstream/'>XB PointStream</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2485/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2485/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2485/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2485&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/10/28/xb-awesome-at-fsoss-2011/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>
	</item>
		<item>
		<title>Fixing Ro.me&#8217;s Turbulent Point Cloud</title>
		<link>http://asalga.wordpress.com/2011/10/24/fixing-ro-mes-turbulent-point-cloud/</link>
		<comments>http://asalga.wordpress.com/2011/10/24/fixing-ro-mes-turbulent-point-cloud/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 19:38:03 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[point cloud]]></category>
		<category><![CDATA[webgl]]></category>
		<category><![CDATA[XB PointStream]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2473</guid>
		<description><![CDATA[Run me A few days ago I noticed the turbulent point cloud demo for ro.me was no longer working in Firefox. Firefox now complains that the array being declared is too large. If you look at the source, you&#8217;ll see the entire point cloud is being stuffed into an array, all 6 megabytes of it. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2473&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://scotland.proximity.on.ca/asalga/demos/turb/">Run me</a><br />
<a href="http://scotland.proximity.on.ca/asalga/demos/turb/"><img src="http://asalga.files.wordpress.com/2011/10/shoe1.png?w=300&#038;h=185" alt="Turbulent Point Cloud" title="Turbulent Point Cloud" width="300" height="185" class="alignnone size-medium wp-image-2477" /></a></p>
<p>A few days ago I noticed the <a href="http://www.ro.me/tech/turbulent-point-cloud">turbulent point cloud demo</a> for ro.me was no longer working in Firefox. Firefox now complains that the array being declared is too large. If you look at the source, you&#8217;ll see the entire point cloud is being stuffed into an array, all 6 megabytes of it. Since it no longer works in Firefox, I thought it would be neat to port the demo to <a href="http://zenit.senecac.on.ca/wiki/index.php/XB_PointStream">XB PointStream</a> to get it working again.</p>
<h4>Stealing Some Data&#8230;</h4>
<p>I looked the source code and copied the array declaration into a empty text file.<br />
<pre class="brush: jscript;">
var array = [1217,-218,40,1218,-218,37,....];
</pre></p>
<p>So I had the data, which was great, but I needed it to be in a format XB PointStream could read. I had to format the vertices to look something like this:<br />
<pre class="brush: jscript;">
1217	-218	40
1218	-218	37
...
</pre></p>
<h4>Conversions</h4>
<p>Using JavaScript to do the conversion only made sense, but I first had to split up the file which contained my array declaration so Firefox could actually load it. After some manual work, I had 6 files—each with its own smaller literal array.</p>
<p>I then wrote a JavaScript script which loaded each array and dumped the formatted text into a web page. I ran my script and copied the output several times until I had the entire file reconstructed as an .ASC file.</p>
<h4>Adding Turbulence</h4>
<p>Once I had the point cloud loaded in XB PointStream, I needed to add some turbulence. I could have used the shader which the original demo used, but I found <a href="http://www.chromeexperiments.com/detail/undulating-monkey/">a demo</a> by <a href="http://www.aerotwist.com">Paul Lewis</a> which I liked a bit better. The demo isn&#8217;t quite as nice as the original, but given more time I could incorporate the original shader as well to make it just as good.</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>, <a href='http://asalga.wordpress.com/category/point-cloud/'>point cloud</a>, <a href='http://asalga.wordpress.com/category/programming/webgl/'>webgl</a>, <a href='http://asalga.wordpress.com/category/xb-pointstream/'>XB PointStream</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2473/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2473/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2473/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2473&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/10/24/fixing-ro-mes-turbulent-point-cloud/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/10/shoe1.png?w=300" medium="image">
			<media:title type="html">Turbulent Point Cloud</media:title>
		</media:content>
	</item>
		<item>
		<title>XB PointStream 0.8 Released</title>
		<link>http://asalga.wordpress.com/2011/10/23/xb-pointstream-0-8-released/</link>
		<comments>http://asalga.wordpress.com/2011/10/23/xb-pointstream-0-8-released/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 03:28:39 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[point cloud]]></category>
		<category><![CDATA[webgl]]></category>
		<category><![CDATA[XB PointStream]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2446</guid>
		<description><![CDATA[Free Cam Visible Human Projection I lost a bit of momentum for this project while fixing some Processing.js tickets, so I&#8217;m releasing the tickets I completed for 0.8 now to keep things moving. Download You can download the library on this page which contains links to the minified and full versions. Change Log Some of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2446&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="http://scotland.proximity.on.ca/asalga/demos/freecam/"><img src="http://asalga.files.wordpress.com/2011/10/freecam1.png?w=150&#038;h=150" alt="" title="freecam" width="150" height="150" class="alignnone size-thumbnail wp-image-2453" /></a></td>
<td>
<a href="http://scotland.proximity.on.ca/asalga/demos/visible%20human/"><img src="http://asalga.files.wordpress.com/2011/10/vishuman.png?w=460" alt="" title="vishuman"   class="alignnone size-full wp-image-2450" /></a></td>
<td>
<a href="http://scotland.proximity.on.ca/asalga/demos/projection/"><img src="http://asalga.files.wordpress.com/2011/10/proj.png?w=460" alt="" title="proj"   class="alignnone size-full wp-image-2457" /></a>
</td>
</tr>
<tr>
<td>Free Cam</td>
<td>Visible Human</td>
<td>Projection</td>
</tr>
</table>
<p>I lost a bit of momentum for this project while fixing some Processing.js tickets, so I&#8217;m releasing the tickets I completed for 0.8 now to keep things moving.</p>
<h2>
<h4>Download</h4>
<p>You can download the library on <a href="http://zenit.senecac.on.ca/wiki/index.php/XB_PointStream">this page</a> which contains links to the minified and full versions.</p>
<h4>Change Log</h4>
<p>Some of the changes include:</p>
<ul>
<li>Added functions to change projection (perspective and orthographic)</li>
<li>Created an &#8216;Export LOD&#8217; script for Python</li>
<li>Added visible human demo</li>
<li>Created fake parser for testing</li>
<li>Added support to delete point clouds</li>
<li>Fixed ASC Exporter to work with Blender 2.59</li>
<li>And <a href="http://cdot.lighthouseapp.com/projects/52886/milestones/105724-09">more fixes&#8230;</a></li>
</ul>
<br />Filed under: <a href='http://asalga.wordpress.com/category/point-cloud/'>point cloud</a>, <a href='http://asalga.wordpress.com/category/programming/webgl/'>webgl</a>, <a href='http://asalga.wordpress.com/category/xb-pointstream/'>XB PointStream</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2446/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2446&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/10/23/xb-pointstream-0-8-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/10/freecam1.png?w=150" medium="image">
			<media:title type="html">freecam</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/10/vishuman.png" medium="image">
			<media:title type="html">vishuman</media:title>
		</media:content>

		<media:content url="http://asalga.files.wordpress.com/2011/10/proj.png" medium="image">
			<media:title type="html">proj</media:title>
		</media:content>
	</item>
		<item>
		<title>Objective-C Strings</title>
		<link>http://asalga.wordpress.com/2011/10/09/objective-c-strings/</link>
		<comments>http://asalga.wordpress.com/2011/10/09/objective-c-strings/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 23:56:47 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2429</guid>
		<description><![CDATA[This is my second blog related to learning Objective-C! I&#8217;m going to briefly look into creating and using simple strings. Since Objective-C is C with object extensions, you can still make use of C-style strings. The language also introduces two classes which make using strings easier: NSString and NSMutableString. NSMutableString inherits from NSString which means [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2429&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is my second blog related to learning Objective-C! I&#8217;m going to briefly look into creating and using simple strings.</p>
<p>Since Objective-C is C with object extensions, you can still make use of C-style strings.</p>
<p><pre class="brush: objc;">
// This is still valid Objective-C string.
const char* cStr = &quot;Hello!&quot;;
</pre></p>
<p>The language also introduces two classes which make using strings easier: <b>NSString</b> and <b>NSMutableString</b>. NSMutableString inherits from NSString which means we can use the mutable version anywhere where we can use an NSString.</p>
<p>As their names suggest NSString&#8217;s individual characters cannot change once they have been set, but we can easily mutate an NSMutableString. The primary reason for this split is efficiency v.s. flexibility. The compiler can efficiently store a string if it knows it will never change. Let&#8217;s take a look at declaring an NSString:</p>
<p><pre class="brush: objc;">
// Create a reference and point it to a statically allocated string.
NSString* nsStr1 = @&quot;This is an Objective-C string&quot;;
</pre></p>
<p>When declaring string literals like this, the compiler will create a static const NSString. The string will be stored within the binary file itself. If you open up the object file you can even find it there.</p>
<p>Just like in C, strings are interned. If you create two static const strings, the compiler will be smart enough to make them point to the same address.</p>
<p><pre class="brush: objc;">
NSString* constStr1 = @&quot;testing...&quot;;
NSString* constStr2 = @&quot;testing...&quot;;

// compare pointers, not contents.
if(constStr1 == constStr2){
  NSLog(@&quot;They are the same!&quot;);
}
</pre></p>
<p>If we wanted to compare their actual contents we can do:</p>
<p><pre class="brush: objc;">
if([constStr1 isEqualToString: constStr2]){
  NSLog(@&quot;They are the same&quot;);
}
</pre></p>
<h4>NSMutableString</h4>
<p>An NSMutableString can be less efficient than an NSString, especially if we&#8217;re copying them a lot. But they do give us flexibility. A common way to instantiate an NSMutableString is:</p>
<p><pre class="brush: objc;">
NSMutableString* nsmString = 
  [NSMutableString stringWithFormat:@&quot;This is a mutable string&quot;];
NSLog(@&quot;%@&quot;, nsmString);
</pre></p>
<p>We can later change the contents of the instance by sending messages to the receiver:</p>
<p><pre class="brush: objc;">
// Change the string entirely.
[nsmString setString: @&quot;Changed mutable string&quot;];
NSLog(@&quot;%@&quot;, nsmString);

// Or append some more text.
[nsmString appendString: @&quot;!!\n&quot;];
NSLog(@&quot;%@&quot;, nsmString);
</pre></p>
<p>That&#8217;s it for now! In my next blog I&#8217;ll start looking into classes and objects.</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/programming/objective-c/'>Objective-C</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2429/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2429&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/10/09/objective-c-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to Objective-C</title>
		<link>http://asalga.wordpress.com/2011/10/01/introduction-to-objective-c/</link>
		<comments>http://asalga.wordpress.com/2011/10/01/introduction-to-objective-c/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 22:37:15 +0000</pubDate>
		<dc:creator>Andor Salga</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://asalga.wordpress.com/?p=2406</guid>
		<description><![CDATA[I began a course for Apple application development which requires me to learn Objective-C. I decided a good way to learn the language would be to write short blogs on the subject. So to begin, some notes about Objective-C… Comments Objective-C allows use of C as well as C++ comments // and /**/ Based on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2406&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I began a course for Apple application development which requires me to learn Objective-C. I decided a good way to learn the language would be to write short blogs on the subject. So to begin, some notes about Objective-C…</p>
<h4>Comments</h4>
<p>Objective-C allows use of C as well as C++ comments // and /**/</p>
<h4>Based on C</h4>
<p>The language is based on C, so we have access to types such as int, float, char, etc.</p>
<h4>New Keywords</h4>
<p>Many new keywords have been added. Some of which are used to directly support object oriented programming. These new keywords are prefixed with  &#8216;@&#8217; to avoid naming conflicts: @class, @interface, @end, @implementation, @protocol are some examples.</p>
<h4>Header Based</h4>
<p>The language is header based. We have a (.h) header file and (.m) implementation file.<br />
The .h file contains our &#8216;C++ class declaration&#8217; which we call the interface. It is in this file which we have the interface, properties and methods.<br />
The .m (which stands for module) contains the implementation for the interface. We write the definitions for the methods and synthesize our properties.</p>
<h4>Strings</h4>
<p>We can use C-style ASCII &#8220;strings&#8221; as well as Objective-C @&#8221;strings&#8221; which can support ASCII and Unicode.</p>
<h4>Preprocessor</h4>
<p>Objective-C has a preprocessor. Instead of using #include we use #import. The import directive does not need to be used in conjunction with include guards.</p>
<h4>toString</h4>
<p>In Java every object inherits from the <b>Object</b> class which has a toString method. In Objective-C, objects which inherit from NSObject can be sent a <b>description</b> message for equivalent behaviour.</p>
<h4>Declarad Properties</h4>
<p>Like C#, Objective-C has direct support for properties. Unlike<br />
C#, we can make Objective-C generate accessor functions.</p>
<h4>Memory Management</h4>
<p>In C++ we use <b>new</b> to dynamically allocate memory for an object. We can then create many pointers to the same object. When the object is no longer needed, we use <b>delete</b> to free the memory. At that point, no pointer which pointed to that object should be dereferenced.</p>
<p>Objective-C uses a reference counting system. We use keywords <b>retain</b> and <b>release</b> to increase and decrease references to an object once it has been initialized. When an object&#8217;s reference counter reaches 0, it is freed by the runtime and a reference pointing to that part of memory should not be sent a message.</p>
<h4>Inheritance</h4>
<p>Like Java, Objective-C only supports single inheritance. And like Java, it supports <b>interfaces</b>, which we call <b>protocols</b>. Furthermore, unlike C++, we can <b>only</b> publicly inherit from another class.</p>
<br />Filed under: <a href='http://asalga.wordpress.com/category/programming/objective-c/'>Objective-C</a>, <a href='http://asalga.wordpress.com/category/open-source/'>Open Source</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/asalga.wordpress.com/2406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/asalga.wordpress.com/2406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/asalga.wordpress.com/2406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/asalga.wordpress.com/2406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/asalga.wordpress.com/2406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/asalga.wordpress.com/2406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/asalga.wordpress.com/2406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/asalga.wordpress.com/2406/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=asalga.wordpress.com&amp;blog=9424798&amp;post=2406&amp;subd=asalga&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://asalga.wordpress.com/2011/10/01/introduction-to-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8e32d9e735409ab223814b42804d3626?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">asalga</media:title>
		</media:content>
	</item>
	</channel>
</rss>
