<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Error_Success</title>
	
	<link>http://error-success.piku.org.uk</link>
	<description>My BLT drive just went AWOL</description>
	<lastBuildDate>Sat, 31 Dec 2011 17:50:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Error_success" /><feedburner:info uri="error_success" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Error_success</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>2011 Review</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/nwYaEIV-Yuo/</link>
		<comments>http://error-success.piku.org.uk/2011/12/31/2011-review/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 17:50:49 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=348</guid>
		<description>I did this last year, and it might be fun to review what I wrote&amp;#8230; So let&amp;#8217;s see, I ended last year&amp;#8217;s post with this So, by this time next...</description>
			<content:encoded><![CDATA[<div id="tweetbutton348" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2lx&amp;text=2011%20Review&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F12%2F31%2F2011-review%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>I did this <a href="http://error-success.piku.org.uk/2010/12/31/2010-review/">last year</a>, and it might be fun to review what I wrote&#8230; So let&#8217;s see, I ended last year&#8217;s post with this</p>
<blockquote><p>So, by this time next year I’ll be happy if I’ve created at least one complete game of some description. I don’t even care if it’s just Pong with a computer opponent you can’t beat. Let’s set the bar nice and low to start with.</p></blockquote>
<p>And if you go over to <a href="http://itunes.apple.com/app/id458479549">iTunes</a> you&#8217;ll see I did indeed manage to create a game called <a href="http://ncot.piku.org.uk/ship-goes-up/">Ship Goes Up</a> <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It took me a number of months and was somewhat fiddly. Some people that bought it even commented that it was quite fun to play. I think that constitutes success. I also managed to help out a <a href="http://www.tcksoft.co.uk/2011/10/09/retro-blitz-my-first-android-game/">friend</a> with an Android game called <a href="http://ncot.piku.org.uk/retro-blitz-for-ios/">Retro Blitz</a> that he&#8217;d wanted to put on the App Store (it was created using some cross-platform tool so converting it to an iOS app was as difficult as compiling the supplied XCode project, tarring it with the App Store glue and waiting for Apple to do their thing).</p>
<p>In other news I received a <a href="http://diary.piku.org.uk/2011/12/26/christmas-1985-all-over-again/">BBC Micro</a> for Christmas along with a <a href="http://diary.piku.org.uk/2011/12/27/building-my-own-computer-from-components/">Fignition</a> AVR-based computer. The BBC Micro needs me to buy an SD card reader for it, and the Fignition needs me to learn Forth. I have ideas to type out some of the simple &#8220;games&#8221; from several 80s computer books that I own. It might make a nice diversion from the other thing I spent this year doing&#8230;</p>
<p>If you&#8217;ve read this blog recently you&#8217;ll have seen several videos of me slowly getting to grips with &#8216;Real&#8217; OpenGL ES 2.0. Real, full-fat OpenGL ES, complete with me having to learn basic linear algebra and other highly confusing concepts. All I can say is that learning something confusing like what a &#8216;ModelViewMatrix&#8217; is takes more than an afternoon of playing in OpenGL. Learning all this stuff seemed to follow the pattern of me reading a book or blog entry about it, getting confused, reading several others, asking some questions, fiddling around for a week or so, then re-reading the books and blogs while thinking &#8220;oh right, that now makes sense!&#8221;. I can&#8217;t learn the stuff without reading the books first, and I can&#8217;t make sense of the books without fiddling with the examples.</p>
<p>Go and learn proper 3D maths now, it&#8217;s really hard <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So, in the name of progress I want to achieve two things next year</p>
<ol>
<li>Make a fun 3D game that people play for more than 30 seconds</li>
<li>Have it sell more than 10 copies</li>
</ol>
<p>so that it&#8217;s worth me renewing my iOS dev license in August. I mean, £59 isn&#8217;t so bad &#8211; it&#8217;s more fun than spending the equivalent on an XBox Live Gold account or shovelling money into WoW or Rift (and I can&#8217;t play those games anyway, I don&#8217;t see a level 50 warrior elf running through the forest, I see a scenegraph apply matrix transformations to a 3D mesh while the entire world is translated down the Z axis).</p>

<p><a href="http://feedads.g.doubleclick.net/~a/7gNslFJ2_SzwJ69rZ0RiP3_j6TY/0/da"><img src="http://feedads.g.doubleclick.net/~a/7gNslFJ2_SzwJ69rZ0RiP3_j6TY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7gNslFJ2_SzwJ69rZ0RiP3_j6TY/1/da"><img src="http://feedads.g.doubleclick.net/~a/7gNslFJ2_SzwJ69rZ0RiP3_j6TY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/nwYaEIV-Yuo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/12/31/2011-review/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/12/31/2011-review/</feedburner:origLink></item>
		<item>
		<title>Scenegraphs are cool…</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/ts5P-HYu8kM/</link>
		<comments>http://error-success.piku.org.uk/2011/12/28/scenegraphs-are-cool/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 22:43:27 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[scene graph]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=350</guid>
		<description>Many things are cool, like this screenshot of XCode for example&amp;#8230; this is what happens when debugging iOS apps that use OpenGL, there&amp;#8217;s a handy button to click that lets...</description>
			<content:encoded><![CDATA[<div id="tweetbutton350" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2lw&amp;text=Scenegraphs%20are%20cool%26%238230%3B&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F12%2F28%2Fscenegraphs-are-cool%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Many things are cool, like this screenshot of XCode for example&#8230;</p>
<div id="attachment_352" class="wp-caption aligncenter" style="width: 586px"><a href="http://error-success.piku.org.uk/files/2011/12/Screen-shot-2011-12-28-at-21.51.31.jpg"><img class=" wp-image-352 " title="Screen shot 2011-12-28 at 21.51.31" src="http://error-success.piku.org.uk/files/2011/12/Screen-shot-2011-12-28-at-21.51.31.jpg" alt="" width="576" height="345" /></a><p class="wp-caption-text">The &#39;Capture OpenGL ES Frame&#39; view in XCode 4</p></div>
<p>this is what happens when debugging iOS apps that use OpenGL, there&#8217;s a handy button to click that lets you poke around in the OpenGL ES state. It shows running GLSL programs and the state of the buffers. Quite useful when you&#8217;re confronted with a black screen.</p>
<p>Anyway, that&#8217;s not what a <a href="http://gamedev.stackexchange.com/questions/8210/scene-graph-as-object-container">scene graph</a> is, I&#8217;m not even sure if what I constructed is really a <a href="http://en.wikipedia.org/wiki/Scene_graph">scene graph</a> either. I do know it&#8217;s a really handy concept that has made structuring my 3D code so much simpler. I always had the problem of how to put a 3D object in the game world at one position, and then have something like a &#8216;drone&#8217; ship orbit that object, or make &#8216;bullets&#8217; shoot out of the ship. Or something simple sounding like have a camera that follows an object (this is not simple BTW, it effectively involves undoing all the transforms made to your scene so that the bit the &#8216;camera&#8217; looks at is positioned at 0,0,0. The maths is horrid but this thread explains <a href="http://www.gamedev.net/topic/180189-matrix-inverse/">matrix inversions</a> well enough).</p>
<p><a href="http://error-success.piku.org.uk/2011/12/28/scenegraphs-are-cool/"><em>Click here to view the embedded video.</em></a></p>
<p>What I created was a simple tree structure that holds the relationships between game entities. Each Entity object has a list of pointers to child Entity objects and so on. This is just an STL vector of pointers to &#8216;Entity&#8217; objects. There&#8217;s an update function that recursively goes down the tree calculating the ModelView matrix of each entity based on the ModelView matrix of its parent. Recursion is cool like that, if you&#8217;ve got a tree you need recursion it makes calculating things very easy.</p>
<p>However, traversing a deeply nested tree isn&#8217;t so useful if I want to find a specific entity (like the player ship because the user just poked the screen), so rather than the tree being a container for all the entities it merely defines relationships between entities. The entities themselves live in a bog standard array that I can quickly loop through pulling out things to draw on the screen, etc. Making an Entity first involves finding a free slot in the master Entity array, then adding its pointer to a suitable parent Entity.</p>
<p>Oh in the demo video ignore the missing right-hand edge of the canyon, I was testing out different camera angles. One day I&#8217;ll work out how to smoothly move the camera from one angle to another to do fly-bys and different game modes. I&#8217;ll probably work that out on the same day I make the enemy ships fly by themselves since it&#8217;s the same thing <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Next thing &#8211; multi touch so there can be steering of the ship and shooting. I got rid of the tilt controls, they were annoying me (mostly because the light in my room was reflecting off the screen!).</p>

<p><a href="http://feedads.g.doubleclick.net/~a/dh2EFVpAln2eBs18UYwEIXWOXSE/0/da"><img src="http://feedads.g.doubleclick.net/~a/dh2EFVpAln2eBs18UYwEIXWOXSE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dh2EFVpAln2eBs18UYwEIXWOXSE/1/da"><img src="http://feedads.g.doubleclick.net/~a/dh2EFVpAln2eBs18UYwEIXWOXSE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/ts5P-HYu8kM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/12/28/scenegraphs-are-cool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/12/28/scenegraphs-are-cool/</feedburner:origLink></item>
		<item>
		<title>Speeding over the icy wastelands of $insert_name_here</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/uYaNZZiMvcI/</link>
		<comments>http://error-success.piku.org.uk/2011/12/14/speeding-over-the-icy-wastelands-of-insert_name_here/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 22:12:25 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=342</guid>
		<description>There has been progress on my &amp;#8220;fly endlessly down some sort of canyon&amp;#8221; iPad thing. Quite a lot of this progress has been non-visual infrastructure code where I&amp;#8217;ve taken hastily...</description>
			<content:encoded><![CDATA[<div id="tweetbutton342" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2lq&amp;text=Speeding%20over%20the%20icy%20wastelands%20of%20%24insert_name_here&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F12%2F14%2Fspeeding-over-the-icy-wastelands-of-insert_name_here%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><div id="attachment_343" class="wp-caption aligncenter" style="width: 310px"><a href="http://error-success.piku.org.uk/files/2011/12/Screen-shot-2011-12-14-at-21.51.51.png"><img class="size-medium wp-image-343" title="Screen shot 2011-12-14 at 21.51.51" src="http://error-success.piku.org.uk/files/2011/12/Screen-shot-2011-12-14-at-21.51.51-300x246.png" alt="" width="300" height="246" /></a><p class="wp-caption-text">It&#39;s getting a bit nippy out</p></div>
<p>There has been progress on my &#8220;fly endlessly down some sort of canyon&#8221; iPad thing. Quite a lot of this progress has been non-visual infrastructure code where I&#8217;ve taken hastily hacked test code and rewritten it in a more reusable and thoughtful manner. The main visual changes are that we&#8217;re now flying over ice and snow after I watched the BBC&#8217;s <em>Frozen Planet</em> series and decided the bit where we fly down a canyon carved out of the Arctic ice sheets looked kind of cool. It&#8217;s also winter and getting a bit cold outside.</p>
<p>I&#8217;ve also got some basic tilt controls working so that the ship moves left and right depending on how you tip the device. Tapping the screen makes the ship rise and fall. I need to adjust this as everything is a bit slow and smooth but for now it&#8217;ll be enough to let me try the next thing on my todo list. There&#8217;s a video to watch below.</p>
<p><a href="http://error-success.piku.org.uk/2011/12/14/speeding-over-the-icy-wastelands-of-insert_name_here/"><em>Click here to view the embedded video.</em></a></p>
<p>So what&#8217;s next? Maybe a few nights spent playing with Milkshape3D drawing low polygon ships to shoot at. I can do quite a lot of gamey stuff if there&#8217;s some opponents, rather than plugging away at invisible infrastructure code &#8211; I wrote some linar algebra to generate an orthographic view for the HUD (that&#8217;s the thing saying &#8216;Yo&#8217; on the screen) and worked out how to have two different shader programs running. All that effort to make a small square appear on the screen. And lots of effort working out how to make this automatically scale to different screen sizes, which works rather well and means an iPhone version just &#8220;plops&#8221; out the compiler with no effort.</p>
<p>It takes hours to make that stuff work, but since it doesn&#8217;t produce anything worth looking at I&#8217;ve not bothered writing about it! I really need to work out some sort of tripod arrangement for my iPhone so I can record videos better, one-handed iPad waving while holding a phone doesn&#8217;t work very well.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/VL8vPkUNfoMC9ZfSu-t3wpWUr0E/0/da"><img src="http://feedads.g.doubleclick.net/~a/VL8vPkUNfoMC9ZfSu-t3wpWUr0E/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/VL8vPkUNfoMC9ZfSu-t3wpWUr0E/1/da"><img src="http://feedads.g.doubleclick.net/~a/VL8vPkUNfoMC9ZfSu-t3wpWUr0E/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/uYaNZZiMvcI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/12/14/speeding-over-the-icy-wastelands-of-insert_name_here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/12/14/speeding-over-the-icy-wastelands-of-insert_name_here/</feedburner:origLink></item>
		<item>
		<title>Problems when your compiler defies sanity and logic</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/BXQBjDJ6kcQ/</link>
		<comments>http://error-success.piku.org.uk/2011/11/26/problems-when-your-compiler-defies-sanity-and-logic/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 17:25:26 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=329</guid>
		<description>If you use XCode and have to deal with C++, Objective-C and Objective-C++ you might one day come across utterly mind-bending compiler errors that seem to defy logic. Weird things...</description>
			<content:encoded><![CDATA[<div id="tweetbutton329" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2lp&amp;text=Problems%20when%20your%20compiler%20defies%20sanity%20and%20logic&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F11%2F26%2Fproblems-when-your-compiler-defies-sanity-and-logic%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><div id="attachment_331" class="wp-caption aligncenter" style="width: 633px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-26-at-17.10.33.png"><img class="size-full wp-image-331 " title="Screen shot 2011-11-26 at 17.10.33" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-26-at-17.10.33.png" alt="" width="623" height="120" /></a><p class="wp-caption-text">Uh oh... someone&#39;s deleted one of my standard C++ headers?!</p></div>
<p>If you use XCode and have to deal with C++, Objective-C and Objective-C++ you might one day come across utterly mind-bending compiler errors that seem to defy logic. Weird things like header files not being found, or GCC somehow forgetting what the keyword &#8216;class&#8217; or &#8216;template&#8217; means.</p>
<p>And it can take hours of head-banging to work out the cause. So here&#8217;s a hint&#8230;</p>
<p><strong>Make sure XCode thinks your source is the correct type. Is it compiling your crazy mix of C++ and Objective-C as Objective-C++, or has it got in a mess and is trying to compile it as Objective-C?</strong></p>
<p>This can happen quite innocently if you hand create an Objective-C++ source file and name it <em>foo.m</em> instead of <em>foo.mm.</em> Especially since nothing bad will happen <em>until you try to #include something that somewhere eventually #includes some C++</em>. So you might have a load of Obj-C that through a chain of #includes/#imports eventually tries to use some C++. And then it&#8217;ll all go wrong.</p>
<div id="attachment_335" class="wp-caption aligncenter" style="width: 664px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-26-at-17.12.26.png"><img class="size-full wp-image-335" title="Screen shot 2011-11-26 at 17.12.26" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-26-at-17.12.26.png" alt="" width="654" height="159" /></a><p class="wp-caption-text">The compiler doesn&#39;t seem know what the &#39;template&#39; keyword means?!</p></div>
<p>You&#8217;ll know it&#8217;s gone wrong when illogical things happen. Things like a file that used to work fine suddenly no longer compiles, even though you&#8217;ve not altered anything inside it (all you did was #include it<em>).</em></p>
<p>Time to find bug &#8211; ten minutes. Time to fix bug &#8211; less than a second.</p>
<p>Coming next&#8230; how to find the location of those bizarre <em>backward_warning.h</em> #warnings.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/YbbXWDPEb6vvANzv4c6W3afHHp8/0/da"><img src="http://feedads.g.doubleclick.net/~a/YbbXWDPEb6vvANzv4c6W3afHHp8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/YbbXWDPEb6vvANzv4c6W3afHHp8/1/da"><img src="http://feedads.g.doubleclick.net/~a/YbbXWDPEb6vvANzv4c6W3afHHp8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/BXQBjDJ6kcQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/11/26/problems-when-your-compiler-defies-sanity-and-logic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/11/26/problems-when-your-compiler-defies-sanity-and-logic/</feedburner:origLink></item>
		<item>
		<title>OOh Crikey! Wot a lot of green!</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/xtoht0IWtPw/</link>
		<comments>http://error-success.piku.org.uk/2011/11/13/ooh-crikey-wot-a-lot-of-green/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 23:34:04 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[vector]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=319</guid>
		<description>Back when I owned an ST (well, I still have it, but you know what I mean) one of my favourite demos was Ooh Crikey! Wot a Scorcher By The Lost...</description>
			<content:encoded><![CDATA[<div id="tweetbutton319" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2li&amp;text=OOh%20Crikey%21%20Wot%20a%20lot%20of%20green%21&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F11%2F13%2Fooh-crikey-wot-a-lot-of-green%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>Back when I owned an ST (well, I still have it, but you know what I mean) one of my favourite demos was <span style="color: #00ffff;"><em><a href="http://www.youtube.com/watch?v=AVHAKO9Q9U8"><span style="color: #00ffff;">Ooh Crikey! Wot a Scorcher</span></a></em></span> By The Lost Boys. The main &#8220;menu&#8221; consisted of a scrolling 3D landscape you had to pilot a small ship over. I think I spent more time exploring that than watching the demos.</p>
<p>To further my learnings of OpenGL I figured it&#8217;d be a nice achievable goal to reproduce something similar on my iPad. Here&#8217;s some screenshots to represent today&#8217;s progress.</p>
<p>My first attempt didn&#8217;t go so well&#8230; there were a few issues with the simple task of drawing some triangles on the screen to represent a flat 2D plane. Amusingly the bugs were nothing to do with drawing vertices, calculating vertex normals or orienting the screen correctly. No, I&#8217;d got my pointer arithmetic a bit messed up and was merrily scribbling all over allocated ram then shovelling nonsense into the GPU. Still, it&#8217;s a nice shade of orange, I might find the RGB for that later.</p>
<div id="attachment_320" class="wp-caption aligncenter" style="width: 250px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-12.44.44.png"><img class="size-medium wp-image-320" title="Screen shot 2011-11-13 at 12.44.44" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-12.44.44-240x300.png" alt="" width="240" height="300" /></a><p class="wp-caption-text">Here in DaliWorld everything is all melty and strange</p></div>
<p>After regaining sanity and having something to eat I managed this lumpy mess. Definitely not the look I am after, I&#8217;ll leave blocky landscapes to other people <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div id="attachment_321" class="wp-caption aligncenter" style="width: 243px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-15.57.47.png"><img class="size-medium wp-image-321" title="Screen shot 2011-11-13 at 15.57.47" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-15.57.47-233x300.png" alt="" width="233" height="300" /></a><p class="wp-caption-text">Look out Notch <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p></div>
<p>Ah, now we&#8217;re getting somewhere&#8230; somewhere very angular but correctly (ish) lit and a whole lot more fun to show on the web. Everything looks a bit too &#8220;big&#8221; and mashed against the screen though.</p>
<div id="attachment_322" class="wp-caption aligncenter" style="width: 238px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-17.09.26.png"><img class="size-medium wp-image-322" title="Screen shot 2011-11-13 at 17.09.26" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-17.09.26-228x300.png" alt="" width="228" height="300" /></a><p class="wp-caption-text">Not safe to land here!</p></div>
<p>Here we go, much better&#8230; if it were 1984 and we still used BBC Micros. Reminds me a bit of Captain Blood on the ST too. Maybe I&#8217;ll have an option to turn the filled triangles off, it&#8217;s a doddle to do. Oh yeah, and I made the iPad the right way around.</p>
<div id="attachment_323" class="wp-caption aligncenter" style="width: 310px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-22.18.51.png"><img class="size-medium wp-image-323" title="Screen shot 2011-11-13 at 22.18.51" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-22.18.51-300x247.png" alt="" width="300" height="247" /></a><p class="wp-caption-text">Pointy Polygons aren&#39;t retro enough</p></div>
<p>And so this is where I am at now. The light shines on the correct side of everything in a <strong>WELCOME TO THE EMERALD CITY OH MY ISN&#8217;T EVERYTHING SO VERY GREEN AND SHINY!</strong> kind of way that seriously needs some attention. Currently it&#8217;s just drawing random data with a canyon carved into it since I couldn&#8217;t be bothered drawing a heightmap and writing yet more text parsing code. Today was &#8220;do fun visual things in OpenGL&#8221; day.</p>
<div id="attachment_324" class="wp-caption aligncenter" style="width: 310px"><a href="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-22.19.29.png"><img class="size-medium wp-image-324" title="Screen shot 2011-11-13 at 22.19.29" src="http://error-success.piku.org.uk/files/2011/11/Screen-shot-2011-11-13-at-22.19.29-300x248.png" alt="" width="300" height="248" /></a><p class="wp-caption-text">Do not adjust your set, allow the soothing green to burn out your eyes</p></div>
<p>When I next get time I want to turn down the colour a lot and make the landscape scroll towards the player. What you can&#8217;t see is a whole jumble of polygons off the screen edges that I really don&#8217;t need to draw. This code is so inefficient <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You&#8217;ll notice this is a landscape game now, that&#8217;s mostly because it&#8217;s much easier to take videos of and stick them on YouTube. I don&#8217;t quite know what the game will be, it could be a sort of <span style="color: #00ffff;"><a href="http://www.youtube.com/watch?v=ALfnZjCiuUQ"><span style="color: #00ffff;">Virus/Zarch</span></a></span> type thing, or a <span style="color: #00ffff;"><a href="http://www.youtube.com/watch?v=NwN3x8GzzFc"><span style="color: #00ffff;">Captain Blood</span></a></span> canyon flying thing. Ship Goes Down The Z Axis anyone?</p>

<p><a href="http://feedads.g.doubleclick.net/~a/7T1WXyvniSuLHY3p-nQPR_i8Hok/0/da"><img src="http://feedads.g.doubleclick.net/~a/7T1WXyvniSuLHY3p-nQPR_i8Hok/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7T1WXyvniSuLHY3p-nQPR_i8Hok/1/da"><img src="http://feedads.g.doubleclick.net/~a/7T1WXyvniSuLHY3p-nQPR_i8Hok/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/xtoht0IWtPw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/11/13/ooh-crikey-wot-a-lot-of-green/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/11/13/ooh-crikey-wot-a-lot-of-green/</feedburner:origLink></item>
		<item>
		<title>OpenGL ES 2.0 First Light</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/dZ6zOOyi6h0/</link>
		<comments>http://error-success.piku.org.uk/2011/10/26/opengl-es-2-0-first-light/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 17:14:57 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[lighting]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=314</guid>
		<description>After a lot of chopping of code, rewriting bits and pieces and generally trying to turn a hacked mess into something more structured I have this&amp;#8230; What you&amp;#8217;re looking at...</description>
			<content:encoded><![CDATA[<div id="tweetbutton314" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2lb&amp;text=OpenGL%20ES%202.0%20First%20Light&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F10%2F26%2Fopengl-es-2-0-first-light%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>After a lot of chopping of code, rewriting bits and pieces and generally trying to turn a hacked mess into something more structured I have this&#8230;</p>
<p><a href="http://error-success.piku.org.uk/2011/10/26/opengl-es-2-0-first-light/"><em>Click here to view the embedded video.</em></a></p>
<p>What you&#8217;re looking at is a pair of spinning spaceship things lit with a moving light. What you&#8217;re <em>really</em> looking at is a clever arrangement of triangles that get coloured in according to some slightly complex maths so that it looks like there&#8217;s a moving light. OpenGL ES 2.0 is funny like that, you get to write your own lighting algorithms (or find them on the Internet).</p>
<p>Now I have the basics of &#8220;construct a 3D model&#8221; &#8220;put it on the screen&#8221; and &#8220;light it so it looks 3D&#8221; working I can get on with making something that isn&#8217;t a tech demo.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/jNgUdLy5ySTc5Iti1qV-Js4wwa8/0/da"><img src="http://feedads.g.doubleclick.net/~a/jNgUdLy5ySTc5Iti1qV-Js4wwa8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/jNgUdLy5ySTc5Iti1qV-Js4wwa8/1/da"><img src="http://feedads.g.doubleclick.net/~a/jNgUdLy5ySTc5Iti1qV-Js4wwa8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/dZ6zOOyi6h0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/10/26/opengl-es-2-0-first-light/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/10/26/opengl-es-2-0-first-light/</feedburner:origLink></item>
		<item>
		<title>Debugging via telepathy</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/OuzuJgEdaZE/</link>
		<comments>http://error-success.piku.org.uk/2011/10/20/debugging-via-telepathy/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 16:59:51 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=301</guid>
		<description>So after creating a fun little iOS game using OpenGL ES 1.1 I decided the next thing I create should use &amp;#8216;real&amp;#8217; 3D, rather than simply bashing OpenGL into managing...</description>
			<content:encoded><![CDATA[<div id="tweetbutton301" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2l9&amp;text=Debugging%20via%20telepathy&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F10%2F20%2Fdebugging-via-telepathy%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>So after creating a fun little <a href="http://ncot.piku.org.uk/ship-goes-up/">iOS game</a> using OpenGL ES 1.1 I decided the next thing I create should use &#8216;real&#8217; 3D, rather than simply bashing OpenGL into managing 2D scenes for me. To make life even harder I decided OpenGL ES 2.0 would be better to learn.</p>
<p>Yeah, there are easy challenges, then there is the equivalent of doing a weekend&#8217;s walking in the Lake District then booking a flight to go walk up Everest. I think I picked the equivalent of trying to swim to the moon. You see the thing with OpenGL ES 1 is that a lot of the &#8216;hard&#8217; stuff is neatly hidden behind handy GL commands &#8211; gl_rotate, gl_lighting and so on. Not so in GLES 2.0, you get to do it all yourself, plus you get to learn all about shaders. In fact you need to learn about them to make anything appear on the screen.</p>
<p>Shaders are fun, they&#8217;re little programs that run on your graphics hardware. They look like C, they get compiled by your code and executed. Little programs that can contain bugs. The interesting part of all this is when you feed wonky code into your machine and it simply quits the software. No errors, no popup warnings&#8230; it just stops working. Or you get a black screen.</p>
<p>I like the challenge of learning this stuff. At one time I had trouble understanding what a &#8216;modelview&#8217; matrix was. Then there was the confusion over linear algebra, and the fun few weeks spent hand coding a Wavefront OBJ loader using vi, gcc and my Wyse serial terminal (who says tedious coding can&#8217;t be fun! Also it&#8217;s quite distraction free coding on a device that can only show 80&#215;25 ASCII characters). Once I&#8217;d done that I managed to make this appear</p>
<div id="attachment_302" class="wp-caption aligncenter" style="width: 269px"><a href="http://error-success.piku.org.uk/files/2011/10/Screen-shot-2011-10-09-at-15.05.13.png"><img class="size-medium wp-image-302" title="Screen shot 2011-10-09 at 15.05.13" src="http://error-success.piku.org.uk/files/2011/10/Screen-shot-2011-10-09-at-15.05.13-259x300.png" alt="" width="259" height="300" /></a><p class="wp-caption-text">Pointy things</p></div>
<p>Oh yeah, to make that I needed to get a 3D modelling package that wasn&#8217;t Blender, learn how to use it and then make it save its data in a format I could actually use. What you can&#8217;t see in that image are the many many failed attempts at getting anything on the screen. Did you know that if you feed a badly constructed vertex buffer object into OpenGL ES on an iPad the device will lock up hard and reboot itself? Yeah debugging that was fun, it doesn&#8217;t do that on the simulator.</p>
<p>So after mastering the difficult technique of making coloured objects appear on the screen I thought it&#8217;d be fun to light them. And this is where I learnt many new things, none of them to do with gouraud lighting algorithms or to do with surface normals. No I learnt lots about how to debug shaders.</p>
<p>Imagine having a horribly complex piece of software that is broken. Imagine your only way to debug it is to look at the code and think really hard. The code either works, or it does something odd that results in a black screen (that&#8217;s why the screen is green in my pictures, at least then I can tell the difference between &#8216;broken&#8217; and &#8216;no colour&#8217;). There&#8217;s no registers to look in, no debugger to play with.</p>
<p>The most important lesson I learned was all to do with connecting the C++ code to the shader. In my code I have a list of vertices, normals, colour data, and so on. The shader code has to somehow receive this data and process it, meaning somehow there is a link between my C++ code and the shader code. It&#8217;s a bit like using LUA in an application, or linking to a DLL. There are symbols and a way to bind them to handles.</p>
<p>This is shader code to define a sort of input variable to the shader, called &#8216;LightPosition&#8217;, you can probably guess its purpose.</p>
<pre>uniform vec3 LightPosition;</pre>
<p>And in the C++ code you do this to connect the two together</p>
<pre>_lightPosition = glGetUniformLocation(programHandle, "LightPosition");</pre>
<p>&#8216;_lightPosition&#8217; is a sort of handle used by other GL commands. glGetUniformLocation() looks into the shader code and finds the &#8216;LightPosition&#8217; variable so that data can be put into it using code such as</p>
<pre>vec3 lightPosition(1, 0, 0);
glUniform3fv(_lightPosition, 1, lightPosition.Pointer());</pre>
<p>(oh yeah, you get to write your own matrix functions too, isn&#8217;t that fun!)</p>
<p>So magic happens and inside the shader the variable &#8216;LightPosition&#8217; gets given the value (1,0,0).</p>
<p>Unless you spell &#8216;LightPosition&#8217; wrong and call it &#8216;lightPosition&#8217;. Then it doesn&#8217;t do anything at all! And nothing notices, nothing gives an error&#8230; it just continues but you see black, unlit shapes instead.</p>
<p>I spent way too many hours taking my code apart and systematically replacing bits of working code with test code, and so on trying to find out why nothing was working. Eventually, quite by accident I found the bug, had a little swear and shout, fixed it, recompiled and &#8230;</p>
<div id="attachment_303" class="wp-caption aligncenter" style="width: 238px"><a href="http://error-success.piku.org.uk/files/2011/10/Screen-shot-2011-10-20-at-17.21.18.png"><img class="size-medium wp-image-303" title="Screen shot 2011-10-20 at 17.21.18" src="http://error-success.piku.org.uk/files/2011/10/Screen-shot-2011-10-20-at-17.21.18-228x300.png" alt="" width="228" height="300" /></a><p class="wp-caption-text">It works!</p></div>
<p>So what&#8217;s next on this severely overhanging learning curve? I think moving the lights around the scene might look quite pretty. Yeah, that can&#8217;t be too hard <img src='http://error-success.piku.org.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/nTqjRGUjhTi9nUn7LISfIBHUTIA/0/da"><img src="http://feedads.g.doubleclick.net/~a/nTqjRGUjhTi9nUn7LISfIBHUTIA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nTqjRGUjhTi9nUn7LISfIBHUTIA/1/da"><img src="http://feedads.g.doubleclick.net/~a/nTqjRGUjhTi9nUn7LISfIBHUTIA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/OuzuJgEdaZE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/10/20/debugging-via-telepathy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/10/20/debugging-via-telepathy/</feedburner:origLink></item>
		<item>
		<title>C++ and Objective-C string manipulations</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/C6y4YUprXp0/</link>
		<comments>http://error-success.piku.org.uk/2011/10/05/c-and-objective-c-string-manipulations/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 20:35:17 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=295</guid>
		<description>&amp;#8230; and a bit of iOS file faffing. Getting paths to files inside the iOS application&amp;#8217;s bundle: NSString* objPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"obj"]; &amp;#8216;objPath&amp;#8217; will now contain the full path...</description>
			<content:encoded><![CDATA[<div id="tweetbutton295" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2l7&amp;text=C%2B%2B%20and%20Objective-C%20string%20manipulations&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F10%2F05%2Fc-and-objective-c-string-manipulations%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>&#8230; and a bit of iOS file faffing.</p>
<p>Getting paths to files inside the iOS application&#8217;s bundle:</p>
<p><code>NSString* objPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"obj"];</code></p>
<p>&#8216;objPath&#8217; will now contain the full path to the file (test.obj in this example). Which is great if you&#8217;re going to poke it into an Obj-C function that understands NSStrings. However if you have C++ code it&#8217;ll probably want to be a std::string.</p>
<p>So to convert an NSString to a C++ std::string you can do this:</p>
<p><code>std::string filepath = [objPath cStringUsingEncoding:[NSString defaultCStringEncoding]];</code></p>
<p>And now you have a std::string with the contents of the NSString. Coding in Objective-C++ is like this, lots of converting one version of a concept to another.</p>
<p>If you like, you can also extract the path to a file using some simple C++:</p>
<p><code>std::string path = "root/data/home/file1.txt";<br />
// no error checking here<br />
std::string prefix = path.substr(0, path.find_last_of('/'));</code></p>
<p>C++ and Objective-C, making your programming efforts feel like it&#8217;s still 1990. I wrote a file parser in straight C++, it was like stepping back into my software engineering degree. There will be a post about it later, it&#8217;ll involve <em>vi</em> and a 9600bps serial terminal.</p>
<p>I found the following Stack Overflow questions useful:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/6319628/c-get-directory-prefix">http://stackoverflow.com/questions/6319628/c-get-directory-prefix</a></li>
<li><a href="http://stackoverflow.com/questions/4313759/files-in-folders-not-found-in-ios-app-using-c">http://stackoverflow.com/questions/4313759/files-in-folders-not-found-in-ios-app-using-c</a></li>
<li><a href="http://stackoverflow.com/questions/3552195/how-to-convert-stdstring-to-nsstring">http://stackoverflow.com/questions/3552195/how-to-convert-stdstring-to-nsstring</a></li>
</ul>

<p><a href="http://feedads.g.doubleclick.net/~a/SuebwT6D45UKtKNs1RKTl8pCCZE/0/da"><img src="http://feedads.g.doubleclick.net/~a/SuebwT6D45UKtKNs1RKTl8pCCZE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/SuebwT6D45UKtKNs1RKTl8pCCZE/1/da"><img src="http://feedads.g.doubleclick.net/~a/SuebwT6D45UKtKNs1RKTl8pCCZE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/C6y4YUprXp0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/10/05/c-and-objective-c-string-manipulations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/10/05/c-and-objective-c-string-manipulations/</feedburner:origLink></item>
		<item>
		<title>Linear Algebra, Analytic Geometry and other stuff you never saw the point of</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/E7sl6d5Kwck/</link>
		<comments>http://error-success.piku.org.uk/2011/09/22/linear-algebra-analytic-geometry-and-other-stuff-you-never-saw-the-point-of/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 10:51:20 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=291</guid>
		<description>There will be a less predictable image in a future post, once I produce something worth looking at that makes sense to you. I&amp;#8217;ve been spending the past few weeks...</description>
			<content:encoded><![CDATA[<div id="tweetbutton291" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2l3&amp;text=Linear%20Algebra%2C%20Analytic%20Geometry%20and%20other%20stuff%20you%20never%20saw%20the%20point%20of&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F09%2F22%2Flinear-algebra-analytic-geometry-and-other-stuff-you-never-saw-the-point-of%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><div id="attachment_292" class="wp-caption alignleft" style="width: 310px"><a href="http://error-success.piku.org.uk/files/2011/09/matrix01.jpg"><img class="size-medium wp-image-292" title="matrix01" src="http://error-success.piku.org.uk/files/2011/09/matrix01-300x125.jpg" alt="" width="300" height="125" /></a><p class="wp-caption-text">I don&#39;t see the 3D shapes, all I see is... err a black screen or OpenGL errors...</p></div>
<p>There will be a less predictable image in a future post, once I produce something worth looking at that makes sense to you.</p>
<p>I&#8217;ve been spending the past few weeks learning how to persuade OpenGL ES 2.0 to behave and draw things on my iPad. During those two weeks I&#8217;ve encountered black screens, madly spinning 2D triangles and even the odd occasion where my iPad force-rebooted itself.</p>
<p>Slowly I&#8217;ve gone from knowing enough OpenGL 1.1 to draw a 2D textured quad, to knowing enough OpenGL ES 2.0 to draw a 3D unlit, untextured shape. And some fiddling with shaders, which they teach you first. Can&#8217;t beat dipping your toes into some entry-level coding tutorial that begins with GPU programming.</p>
<p>Matrices went from a vague mystery to something that no longer gives me a headache, and stuff isn&#8217;t upside down any more. Remember kids, pay attention in maths at school, 16 years later you might need that knowledge.</p>
<p>It&#8217;s a steep learning curve with fractal-like diversions as you learn just enough to be dangerous, getting ideas like &#8220;so then&#8230; rotating an object to face another, that&#8217;d be useful to do&#8221;.</p>
<p>My next two things are &#8220;load Wavefront OBJ files&#8221; and &#8220;lighting&#8221;.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/YzA2WwqzKDScLsI-JRiOSlIbllM/0/da"><img src="http://feedads.g.doubleclick.net/~a/YzA2WwqzKDScLsI-JRiOSlIbllM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/YzA2WwqzKDScLsI-JRiOSlIbllM/1/da"><img src="http://feedads.g.doubleclick.net/~a/YzA2WwqzKDScLsI-JRiOSlIbllM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/E7sl6d5Kwck" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/09/22/linear-algebra-analytic-geometry-and-other-stuff-you-never-saw-the-point-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/09/22/linear-algebra-analytic-geometry-and-other-stuff-you-never-saw-the-point-of/</feedburner:origLink></item>
		<item>
		<title>Repairing missing Git support in XCode 4</title>
		<link>http://feedproxy.google.com/~r/Error_success/~3/JcGeCqV4mmU/</link>
		<comments>http://error-success.piku.org.uk/2011/08/04/repairing-missing-git-support-in-xcode-4/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 22:31:51 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://error-success.piku.org.uk/?p=285</guid>
		<description>If you have a freshly installed copy of Snow Leopard, and an equally freshly installed copy of XCode 4 you&amp;#8217;ll find that XCode 4 doesn&amp;#8217;t support the git source control...</description>
			<content:encoded><![CDATA[<div id="tweetbutton285" class="tw_button" style=""><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.piku.org.uk%2Fs%2F2kj&amp;text=Repairing%20missing%20Git%20support%20in%20XCode%204&amp;related=pickoo&amp;lang=en&amp;count=horizontal&amp;counturl=http%3A%2F%2Ferror-success.piku.org.uk%2F2011%2F08%2F04%2Frepairing-missing-git-support-in-xcode-4%2F" class="twitter-share-button"  style="width:55px;height:22px;background:transparent url('http://error-success.piku.org.uk/wp-content/plugins/wp-tweet-button/tweetn.png') no-repeat  0 0;text-align:left;text-indent:-9999px;display:block;">Tweet</a></div><p>If you have a freshly installed copy of Snow Leopard, and an equally freshly installed copy of XCode 4 you&#8217;ll find that XCode 4 doesn&#8217;t support the <em>git</em> source control system. This can be a problem that suddenly happens after reinstalling OSX, but fortunately the fix is very simple.</p>
<p>XCode expects the <em>git</em> binary to be in <em>/usr/bin</em> however OSX installs Git in <em>/usr/local/git/bin</em>. Fixing it is as difficult as setting up an appropriate symbolic link and restarting XCode:</p>
<p>Find out where git is</p>
<pre>
cubee:~ james$ which git
/usr/local/git/bin/git
</pre>
<p>Create a symbolic link</p>
<pre>
cubee:~ james$ sudo ln -s /usr/local/git/bin/git /usr/bin/git
</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/g90qwsyw7t1dvfs5UAxo-T0OLng/0/da"><img src="http://feedads.g.doubleclick.net/~a/g90qwsyw7t1dvfs5UAxo-T0OLng/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/g90qwsyw7t1dvfs5UAxo-T0OLng/1/da"><img src="http://feedads.g.doubleclick.net/~a/g90qwsyw7t1dvfs5UAxo-T0OLng/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/Error_success/~4/JcGeCqV4mmU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://error-success.piku.org.uk/2011/08/04/repairing-missing-git-support-in-xcode-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://error-success.piku.org.uk/2011/08/04/repairing-missing-git-support-in-xcode-4/</feedburner:origLink></item>
	</channel>
</rss>

