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

<channel>
	<title>Black Pixel</title>
	<atom:link href="http://blackpixel.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blackpixel.com</link>
	<description></description>
	<lastBuildDate>Mon, 01 Mar 2010 22:11:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Agent Craig Maintenance Update (version 1.08)</title>
		<link>http://blackpixel.com/blog/668/agent-craig-maintenance-update-version-1-08/</link>
		<comments>http://blackpixel.com/blog/668/agent-craig-maintenance-update-version-1-08/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 22:11:27 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[Agent Craig]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=668</guid>
		<description><![CDATA[
A maintenance release of Agent Craig has been uploaded to the server and can be downloaded here.  This update restores compatibility with the existing Craig's List site.


Black Pixel will be providing compatibility support through the end of the year, by which time an significantly updated version should be made available for to the public [...]]]></description>
			<content:encoded><![CDATA[<p>
A maintenance release of Agent Craig has been uploaded to the server and can be downloaded <a href="http://blackpixel.com/updates/AgentCraig_1.08.dmg">here</a>.  This update restores compatibility with the existing Craig's List site.
</p>
<p>
Black Pixel will be providing compatibility support through the end of the year, by which time an significantly updated version should be made available for to the public (free to existing users).</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/668/agent-craig-maintenance-update-version-1-08/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best of both worlds</title>
		<link>http://blackpixel.com/blog/576/best-of-both-worlds/</link>
		<comments>http://blackpixel.com/blog/576/best-of-both-worlds/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 22:08:43 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=576</guid>
		<description><![CDATA[
As much as we've enjoyed working with Apple and the iPhone, development for this platform has not been without its share of challenges.  One of the biggest has been, and to a large extent, still will be, visibility: getting customers aware that your application exists and getting them to try out your applications have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blackpixel.com/wp/wp-content/uploads/2009/10/iStock_000008706847XSmall.jpg"><img src="http://blackpixel.com/wp/wp-content/uploads/2009/10/iStock_000008706847XSmall.jpg" alt="Let us eat cake. Or let us have our cake and eat it too. Or whatever." /></a></p>
<p>As much as we've enjoyed working with Apple and the iPhone, development for this platform has not been without its share of challenges.  One of the biggest has been, and to a large extent, still will be, visibility: getting customers aware that your application exists and getting them to try out your applications have represented a major ordeal for some vendors.</p>
<p>
Fortunately, one of the major barriers to the adoption of high-end iPhone applications has just been struck down.  Apple just announced today that in-app purchases will now be allowed for free applications.  This is fantastic:</p>
<blockquote>
<p>In App Purchase is being rapidly adopted by developers in their paid apps. Now you can use In App Purchase in your free apps to sell content, subscriptions, and digital services.</p>
<p>You can also simplify your development by creating a single version of your app that uses In App Purchase to unlock additional functionality, eliminating the need to create Lite versions of your app. Using In App Purchase in your app can also help combat some of the problems of software piracy by allowing you to verify In App Purchases.</p>
<p>Visit the App Store Resource Center for more details about how you can add In App Purchases to your free apps.</p>
</blockquote>
<p>One thing that we personally found amazing about this announcement was that it hit our email in the middle of a discussion that Chris Clark and I were having about which app store strategy we should adopt for one of our own applications.</p>
<p>The email made the entire conversation completely moot.</p>
<h3>Marketing 101</h3>
<p>One of the biggest challenges facing the developers of high-quality applications has been exposure. Most users are unwilling to pay $4.99 for an application that they can't try, and many of these apps get passed in favor of cheaper, less risky offerings.   </p>
<p>Obviously, one of the most important things for high-end app developers to do is get their application in front of users so that they can get a chance to try it and find out if it meets their needs.  This is why companies like Adobe offer 30 day, full-functionality trials of their applications.</p>
<p>In-app purchasing can be used to unlock existing code in an application, which provides a good way to provide additional features for users.  The problem with this was that, until today, you could only provide in-app purchases for paid applications, which meant that you needed to charge at least $0.99 for your upgradeable app.</p>
<p>Unfortunately, as <a href="http://blog.hogbaysoftware.com/post/170655672/writeroom-iphone-4-99-daily-sales-compared-to">Hog Bay Software discovered</a> with <a href="http://www.hogbaysoftware.com/products/writeroom_iphone">WriteRoom</a>, the number of people that will download a $0.99 app is less than 10% of those that will check out a free one. This means that the audience you could reach using in-app purchases for upgrades would be dramatically smaller than you'd get if you could make it free.</p>
<h3>The two-fold path: lite apps</h3>
<p>Prior to today, the only way to really get any exposure was to offer a limited-functionality lite version of the application for free in addition to a full priced, premium version of the application.</p>
<p>With the Lite app model, you'd have to maintain two of each app, and people would need to buy and install a completely different application if they wanted to go ahead and buy the full version of your software.  This opens up a few different logistical issues, like the fact that any user data compiled using one application will either need to be transferred to the full version, or simply scrapped altogether.</p>
<h3>Have your cake and eat it, too</h3>
<p>Now we get the best of both worlds: the extensive exposure that a free application provides, a very easy registration path for users that want to unlock the software, and data coherence between the free and full versions of the application. </p>
<p>The very best option, which I do not think that Apple will go for (at least, based on what I knew before today) would be to have a time-limited period of full functionality for applications, that would eventually become disabled (resulting in 'lite' functionality) and could be permanently unlocked via in-app purchase.</p>
<p>
<strong>Update:</strong> <a href="http://twitter.com/marcoarment">Marco Arment</a> has weighed in on this as well and <a href="http://www.marco.org/214082853">raises some excellent points</a>.</p>
<p>
<strong>Update 2:</strong> Additional commentary from <a href="http://www.tuaw.com/2009/10/15/apple-relents-in-app-purchase-for-free-apps-allows-demo-to-paid/">The Unofficial Apple Weblog</a>.</p>
<p>(woo!)</p>
<p>-Daniel</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/576/best-of-both-worlds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode: Using #includes in OpenGL Shaders</title>
		<link>http://blackpixel.com/blog/494/xcode-using-includes-in-opengl-shaders/</link>
		<comments>http://blackpixel.com/blog/494/xcode-using-includes-in-opengl-shaders/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 16:04:16 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=494</guid>
		<description><![CDATA[
One of the big problems with OpenGL shaders is that the runtime compiler doesn't provide an include mechanism to let you easily share common code between multiple vertex and fragment shaders.  At the present, if you have a common function that you'd like to use in more than one shader your only real option [...]]]></description>
			<content:encoded><![CDATA[<p>
One of the big problems with OpenGL shaders is that the runtime compiler doesn't provide an include mechanism to let you easily share common code between multiple vertex and fragment shaders.  At the present, if you have a common function that you'd like to use in more than one shader your only real option is to maintain separate copies of the function in each of the shader source files you want to use it in.
</p>
<p>
This is a point of pain for several reasons, the biggest of which is maintainability.  If you find a bug or make an enhancement to the common function you have to go back and update each individual copy.  Also, the code clutters the shaders and detracts your focus from the code specific to that particular file.
</p>
<p>
This blog post details the method I use to separate out common shader code into separate files and access it from multiple OpenGL shaders.
</p>
<h3>Introducing m4, the unix preprocessor</h3>
<p>
<a href="http://en.wikipedia.org/wiki/m4_(computer_language)">m4</a> is a standard UNIX tool orginally developed by <a href="http://en.wikipedia.org/wiki/Brian_Kernighan">Kernighan</a> and <a href="http://en.wikipedia.org/wiki/Dennis_Ritchie">Ritchie</a> in 1977.  The most common version today is <a href="http://www.gnu.org/software/m4/m4.html">GNU m4</a>, which found on most UNIX-based systems, including OS X and Linux.  m4 is not particularly well-known to most users, but is a well regarded workhorse and a foundation for most UNIX services.  As an example, m4 is used extensively in <a href="http://www.gnu.org/software/autoconf/autoconf.html">GNU Autoconf</a>.
</p>
<p>
m4 is a command line tool that acts as a preprocessor, similar in concept to the regular C preprocessor but with a few syntactic differences.  You can use m4 to define your own macros for text expansion and can also insert the contents of one or more files into another by use of the m4 <b>include</b> directive.
</p>
<h3>Using m4 with your shaders</h3>
<p>
In this example, let's imagine that you have some common lighting code you'd like to be able to share between multiple different shaders.  The goal is to maintain the lighting code in one file and be able to call that code from the shaders that need to use it.
</p>
<p>
In this example we have two vertex shaders, creatively named shader1.vs and shader2.vs, that will need to use the lighting code.  We'll use m4 to pull the lighting code into the shader files when we build our project, and store off merged versions of the shader text files in our application bundle (see below).
</p>
<p class="chart"><img src="http://blackpixel.com/wp/wp-content/uploads/2009/07/screen-shot-2009-07-22-at-92531-am.png" alt="Flow chart shows the m4 preprocessor merging two files into a temporary output file, then moving and renaming that output file to a desired location." width="512" height="500" /></p>
<p>
The final shader output files will look more like conventional shaders: the lighting function will be defined up above the shader's main() method and appear in full in both shader1.vs and shader2.vs, so the runtime compiler will have no problem building and loading them when you go to use them in your application.
</p>
<h3>Showtime</h3>
<p>First off, let's look at lighting.vs</p>
<pre class="c">&nbsp;
<span style="color: #993333;">struct</span> directional_light <span style="color: #66cc66;">&#123;</span>
	vec3 direction;
	vec3 halfplane;
	vec4 ambient_color;
	vec4 diffuse_color;
	vec4 specular_color;
<span style="color: #66cc66;">&#125;</span>;
&nbsp;
<span style="color: #993333;">struct</span> material_properties <span style="color: #66cc66;">&#123;</span>
	vec4 ambient_color;
	vec4 diffuse_color;
	vec4 specular_color;
	<span style="color: #993333;">float</span>	specular_exponent;
<span style="color: #66cc66;">&#125;</span>;
&nbsp;
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> c_zero = <span style="color: #cc66cc;">0.0</span>;
<span style="color: #993333;">const</span> <span style="color: #993333;">float</span> c_one = <span style="color: #cc66cc;">1.0</span>;
&nbsp;
material_properties material;
directional_light light;
&nbsp;
vec4 calc_directional_light<span style="color: #66cc66;">&#40;</span>in vec3 normal<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	vec4 computed_color = vec4<span style="color: #66cc66;">&#40;</span>c_zero, c_zero, c_zero, c_zero<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #993333;">float</span> ndot1;
	<span style="color: #993333;">float</span> ndoth;
	ndot1 = max<span style="color: #66cc66;">&#40;</span>c_zero, dot<span style="color: #66cc66;">&#40;</span>normal, light.<span style="color: #202020;">direction</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	ndoth = max<span style="color: #66cc66;">&#40;</span>c_zero, dot<span style="color: #66cc66;">&#40;</span>normal, light.<span style="color: #202020;">halfplane</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	computed_color += <span style="color: #66cc66;">&#40;</span>light.<span style="color: #202020;">ambient_color</span> * material.<span style="color: #202020;">ambient_color</span><span style="color: #66cc66;">&#41;</span>;
	computed_color += <span style="color: #66cc66;">&#40;</span>ndot1 * light.<span style="color: #202020;">diffuse_color</span> * material.<span style="color: #202020;">diffuse_color</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> ndoth &gt; c_zero<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#123;</span>
		computed_color += <span style="color: #66cc66;">&#40;</span>pow<span style="color: #66cc66;">&#40;</span>ndoth, material.<span style="color: #202020;">specular_exponent</span><span style="color: #66cc66;">&#41;</span> * material.<span style="color: #202020;">specular_color*</span> light.<span style="color: #202020;">specular_color</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
	<span style="color: #b1b100;">return</span> computed_color;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>
Including all of that in each shader file directly would add a lot more text to wade through!  So let's use m4 instead.  Here's what we'll put in shader1.vs
</p>
<pre class="c">&nbsp;
include<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Lighting.vs'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">// &lt; - much more compact!</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 *	Uniform attributes
 */</span>
uniform mat4	u_mvp_matrix;		<span style="color: #808080; font-style: italic;">// Modelview matrix</span>
uniform mat4	u_project_matrix;	<span style="color: #808080; font-style: italic;">// Projection matrix</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 *	Assigned attributes specific to this vertex
 */</span>
attribute vec4	a_position;
attribute vec4	a_vertColor;
attribute vec3	a_normal;
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// Do stuff</span>
	...
	<span style="color: #808080; font-style: italic;">// Now do our lighting calculation</span>
	vec4 color = calc_directional_light<span style="color: #66cc66;">&#40;</span>a_normal<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #808080; font-style: italic;">// Do more stuff</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<h3>Pulling it all together</h3>
<p>
Finally, we'll add a Run Script step as the last part of our Xcode target to do the final shader merges automatically at the end of each build.  Here's the contents of the script step:</p>
</pre>
<pre class="bash">&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> build/<span style="color: #007800;">$CONFIGURATION</span>-iphoneos/myIphoneApp.app
<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> `<span style="color: #c20cb9; font-weight: bold;">ls</span> *.vs`; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">m4</span> <span style="color: #007800;">$f</span> &gt; <span style="color: #007800;">$f</span>.tmp;mv <span style="color: #007800;">$f</span>.tmp <span style="color: #007800;">$f</span>; <span style="color: #000000; font-weight: bold;">done</span>;
<span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> `<span style="color: #c20cb9; font-weight: bold;">ls</span> *.fs`; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">m4</span> <span style="color: #007800;">$f</span> &gt; <span style="color: #007800;">$f</span>.tmp;mv <span style="color: #007800;">$f</span>.tmp <span style="color: #007800;">$f</span>; <span style="color: #000000; font-weight: bold;">done</span>;
&nbsp;</pre>
<p>
Assuming that your application's name was myIphoneApp, this script would:
</p>
<ol>
<li>dive into the application bundle in your build directory</li>
<li>get a listing of all of the vertex shader files</li>
<li>run the following process on each shader file found:
<ol>
<li>run m4 on the file</li>
<li>store the output to a temporary file</li>
<li>replace the original file with the temporary file</li>
</ol>
</li>
<li>repeat steps 1 thought 3 for each fragment shader file</li>
</ol>
<p>
The preprocessing step simply acts as a pass-through on files that don't contain m4-specific directives, so it won't do any harm to files that aren't including lighting.vs.
</p>
<p>
That's all there is to it! I hope that this is helpful to people.  If anyone has any suggestions for improvements I would be very interested in hearing your feedback.
</p>
<p>
-<a href="http://twitter.com/dlpasco">Daniel</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/494/xcode-using-includes-in-opengl-shaders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Vertex Buffer Object Performance</title>
		<link>http://blackpixel.com/blog/399/iphone-vertex-buffer-object-performance/</link>
		<comments>http://blackpixel.com/blog/399/iphone-vertex-buffer-object-performance/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 15:38:51 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=399</guid>
		<description><![CDATA[
Another performance enhancement we attempted on Plasma was to follow Apple's Techniques for Working with VertexData guidelines, which state


Each time glDrawElements is called, the data is retransmitted to the graphics hardware to be rendered. If the data did not change, those additional copies are unnecessary. To avoid this, your application should store its geometry in [...]]]></description>
			<content:encoded><![CDATA[<p>
Another performance enhancement we attempted on <a href="http://www.taptaptap.com/blog/iphone-3gs-blows-away-iphone-3g-in-3d/">Plasma</a> was to follow Apple's <a href="http://developer.apple.com/iphone/library/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html">Techniques for Working with VertexData</a> guidelines, which state
</p>
<blockquote><p>
Each time glDrawElements is called, the data is retransmitted to the graphics hardware to be rendered. If the data did not change, those additional copies are unnecessary. To avoid this, your application should store its geometry in a vertex buffer object (VBO). Data stored in a vertex buffer object is owned by OpenGL ES and may<a id="footnoteref" href="#footnote">*</a> be cached by the hardware or driver to improve performance.
</p>
</blockquote>
<h3>Vertex Buffer Performance Comparison</h3>
<p>
In order to get a sense of how the VBOs might affect performance, I modified the <a href="http://www.opengles-book.com">original code samples</a> provided by Aaftab Munshi, Dan Ginsburg, Dave Shreiner to have an option to use VBOs, and did the same with the <a href="http://blackpixel.com/blog/300/opengl-performance-impact-of-point-size/">ES 1.1 port</a> I'd made as well.
</p>
<p>
I expected that the ES 2.0 shader code would show some degree of performance boost, because all of the vertex data is defined once, at start up, and permuted on the GPU based on a few uniform attributes that are passed to the shaders at the start of the draw pass.
</p>
<p>
The results of the tests appear below:
</p>
<table>
<thead>
<tr>
<th>Implementation</th>
<th>3G/ES1.1</th>
<th>3GS/ES1.1</th>
<th>3GS/ES2.0</th>
</tr>
</thead>
<tbody>
<tr>
<th>Client-side arrays</th>
<td>46 fps</td>
<td>56 fps</td>
<td>55 fps</td>
</tr>
<tr>
<th>Interlaced VBOs</th>
<td>46 fps</td>
<td>56 fps</td>
<td>55 fps</td>
</tr>
<tr>
<th>Improvement</th>
<td>None</td>
<td>None</td>
<td>None</td>
</tr>
</tbody>
</table>
<p>
In the case of the ES 1.1 VBO code, I'm calling glBufferData(GL_DYNAMIC_DRAW), as GL_STREAM_DRAW isn't available under 1.1.  Given that this is a particle animation, and the vertex data is changing on each drawing pass, one could definitely question the efficacy of using VBOs at all, but these results are also consistent with what we've seen using VBOs on the iPhone for static scene elements as well.
</p>
<p>
What was very surprising to me is that there was also no benefit seen using VBOs with the ES 2.0 shaders, even using the newer <a href="http://www.imgtec.com/PowerVR/sgx.asp">PowerVR SGX</a> graphics processor.  Evidently the overhead between pushing the vertex data to the GPU on each pass compared to just accessing the buffered data is negligible. I was also somewhat taken aback by the fact that the ES 2.0 version on the 3GS consistently ran slightly slower than the ES 1.1 version.
</p>
<p><h3>Analysis</h3>
<p>In retrospect, most of these results actually make sense, given that the iPhone uses a <a href="http://developer.apple.com/iphone/library/technotes/tn2008/tn2230.html">shared memory</a> architecture.  The VBOs that are setup in the program are not actually cached directly on the graphics hardware, but are regular blocks of memory, right along side all of your other application data.
</p>
<p>
As an outsider, it's hard to say for sure what is going on under the hood, but my speculation is that all of these implementations do nothing more than move pointers to the data buffers around instead of block copy operations, whether you are using VBOs or not.
</p>
<p><h3>The bottom line</h3>
<p>Given the results shown, I'm really unsure exactly why Apple has been banging the vertex buffer drum as stridently as they have, unless they were simply copying the PowerVR technical notes word-for-word.  The only real benefit I can see to using VBOs is that it can allow you to use a consistent codebase, if parts of your GL code are also running on platforms that actually cache the buffers on the graphics hardware, or for possible future-proofing for any forthcoming Apple devices in which VBOs actually make a difference.
</p>
<p>
It's really hard to say if a shared memory implementation is better than having onboard memory for the GPU.  Most CPUs enjoy a considerable performance benefit from having a local cache, letting them access cached data directly instead of having to go out over the bus to access it.
</p>
<p>
-<a href="http://twitter.com/dlpasco">Daniel</a>
</p>
<hr />
<p id="footnote"  class="footnote">*Considering the results of our testing, it might be more appropriate to say "won't" <a href="#footnoteref">â†©</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/399/iphone-vertex-buffer-object-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL: Performance impact of point size</title>
		<link>http://blackpixel.com/blog/300/opengl-performance-impact-of-point-size/</link>
		<comments>http://blackpixel.com/blog/300/opengl-performance-impact-of-point-size/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 15:46:52 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=300</guid>
		<description><![CDATA[In the course of our work on Plasma, getting the best possible performance out of the iPhone has been one of our top priorities. One of our goals was to get quantitative measurements of the performance of the various iPhones and iPod Touches to get a real sense of the capability space represented by these [...]]]></description>
			<content:encoded><![CDATA[<p>In the course of our work on Plasma, getting the best possible performance out of the iPhone has been one of our top priorities. One of our goals was to get quantitative measurements of the performance of the various iPhones and iPod Touches to get a real sense of the capability space represented by these devices.  This post is the first of six articles detailing the results of our work.</p>
<h3>Background</h3>
<p>At one point we were looking at using GL_POINTS for some of the particles in our app, but the graphics requirements just about caused the iPhone 3G to burst into flame.  One thing that I tried fairly early on was using fewer, larger points instead of a large number of small ones.</p>
<p>Both configurations resulted in terrible performance on the 3G, and I eventually I setup a separate, sandbox application to see if we could characterize what was going on.</p>
<h3>ES 1.1 Testbed Application</h3>
<p><a href="http://soft-arts.net/wp-content/uploads/2009/07/img-0016.png"><img src="http://soft-arts.net/wp-content/uploads/2009/07/img-0016.png" alt="60 frames per second at point size 12" width="160" class="figure" /></a><a href="http://soft-arts.net/wp-content/uploads/2009/07/img-0018.png"><img src="http://soft-arts.net/wp-content/uploads/2009/07/img-0018.png" alt="39.5 frames per second at point size 48" width="160" class="figure" /></a> To this end, I developed an entirely separate codebase, based in large part on the <a href="http://www.opengles-book.com">code samples</a> provided by Aaftab Munshi, Dan Ginsburg, Dave Shreiner in support of their very excellent <a href="http://my.safaribooksonline.com/9780321563835?portal=informit">OpenGLÂ® ES 2.0 Programming Guide</a>.  Using this application allowed us to try out different configurations in the simplest possible program and get a qualitative and quantitative sense of how the changes affected performance.</p>
<p>The application uses OpenGL 1.1 (so that we could get an apples-to-apples comparison across all three devices) to render 1000 points in a continuous particle animation, with an initial point size of 12.  Double tapping the screen successively increases the point size to 24, 48, and 64. As can be seen from the screenshots below (taken from a 3GS) the performance for a fixed number of particles drops significantly as the point size goes up.</p>
<h3>Test results: size matters</h3>
<p>The results of the tests on the three platforms considered appear below.</p>
<table>
<tr>
<th>Point Size</th>
<th>3GS</th>
<th>2G Touch</th>
<th>3G</th>
</tr>
<tr>
<th>12 </th>
<td>60 fps</td>
<td>60 fps</td>
<td>50 fps</td>
</tr>
<tr>
<th>24</th>
<td>55 fps</td>
<td>45 fps</td>
<td>33 fps</td>
</tr>
<tr>
<th>48</th>
<td>43 fps</td>
<td>26 fps</td>
<td>19 fps</td>
</tr>
<tr>
<th>64</th>
<td>32.5 fps</td>
<td>18 fps</td>
<td>12.5 fps</td>
</tr>
</table>
<p class="chart">
<img src="http://blackpixel.com/wp/wp-content/uploads/2009/07/screen-shot-2009-07-20-at-110542-am.png" alt="Chart of performance degradation as a function of point size. Performance is negatively correlated to point size" width="420" height="300" />
</p>
<p>In every case, performance dropped significantly, most dramatically on the iPhone 3G.  At a point size of 12, the 2G Touch and the 3GS ran at about the same speed, with the 3G clocking in at about 17 percent slower.  At the extreme range, the 3GS had its performance almost cut in half, while the 2G Touch and 3G had suffered performance decreases of 70 percent and 75 percent, respectively.</p>
<h3>iPhone 3GS Performance Gains</h3>
<p>What's interesting about this is not just that performance drops as you make your points larger, but that the iPhone 3GS starts to show a very large performance advantage over its predecessors at larger point sizes.  At a point size of 64, the iPhone 3GS is still running at a very reasonable 32.5 fps, about 2.6 times faster than the iPhone 3G.</p>
<p class="chart"><img src="http://blackpixel.com/wp/wp-content/uploads/2009/07/screen-shot-2009-07-20-at-110529-am.png" alt="Chart showing iPhone 3GS performance gains of 2G Touch and 3G iPhone." width="471" height="340" /></p>
<h3>Conclusions</h3>
<p>Obviously, point size has a significant impact on the iPhone's overall 3D performance, but this effect is substantially ameliorated on the more powerful 3GS. We are only considering cases in which points are texture mapped and blended, so colored points without blending may be affected to a lesser degree than shown here.</p>
<p>In any case, if large particles are desired, better results may be obtained using textured quads instead of points. We'll have more to say on this option later.</p>
<p>-<a href="http://twitter.com/dlpasco">Daniel</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/300/opengl-performance-impact-of-point-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feed Me!</title>
		<link>http://blackpixel.com/blog/288/feed-me/</link>
		<comments>http://blackpixel.com/blog/288/feed-me/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:13:48 +0000</pubDate>
		<dc:creator>Chris Clark</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=288</guid>
		<description><![CDATA[
We're very pleased to announce Feed Me, the cutest little educational game in the known universe, is available on the iPhone App Store! You should download it right now, but be prepared to have your kids all over your iPhone: learning colors, numbers, shapes, and patterns, unlocking trophies, and tickling the hungry little monster's belly.
We [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blackpixel.com/wp/wp-content/uploads/2009/07/feed-me-monster.png" alt="" width="134" height="136" /></p>
<p>We're very pleased to announce <a href="http://www.pencilbot.com/kids/PencilBot_Kids/Feed_Me.html">Feed Me</a>, the cutest little educational game in the known universe, is available on the iPhone App Store! You should <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321041261&amp;mt=8">download it right now</a>, but be prepared to have your kids all over your iPhone: learning colors, numbers, shapes, and patterns, unlocking trophies, and tickling the hungry little monster's belly.</p>
<p>We developed Feed Me with our friends at <a href="http://www.pencilbot.com/kids/">PencilBot Kids</a>, and it's available in eight languages, so it's a great vocabulary game too. We're super excited, and we think you're going to love it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/288/feed-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Early iPhone 3G S OpenGL Test Results</title>
		<link>http://blackpixel.com/blog/244/early-iphone-3g-s-opengl-test-results/</link>
		<comments>http://blackpixel.com/blog/244/early-iphone-3g-s-opengl-test-results/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 05:41:46 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=244</guid>
		<description><![CDATA[
Holy crap, this thing is fast


The new iPhone 3G S arrived today and I've been putting it through its paces by testing it out with several different configurations of the latest build of Plasma, an application I am developing for Tap Tap Tap.  Plasma utilizes a lot of particle animation and is CPU intensive, [...]]]></description>
			<content:encoded><![CDATA[<p>
Holy crap, this thing is <em>fast</em>
</p>
<p>
The new <a href="http://www.apple.com/iphone/">iPhone 3G S</a> arrived today and I've been putting it through its paces by testing it out with several different configurations of the latest build of Plasma, an application I am developing for <a href="http://taptaptap.com/">Tap Tap Tap</a>.  Plasma utilizes a lot of particle animation and is CPU intensive, so I've been eager to get a build running on the 3G S as soon as possible.  As a reference point, I also ran all of the same tests on a second generation iPod Touch.
</p>
<p><h2>Hardware comparison</h2>
<p>iPod Touch 2g:<br />
CPU: Arm 6 running at 533 MHz<br />
GPU: PowerVR MBX Lite</p>
<p>iPhone 3G S:<br />
CPU: Arm 7 running at 600 MHz<br />
GPU: PowerVR SGX
</p>
<p><h2>Results</h2>
<p>After several different tests, the overall trend was starkly apparent: </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>the iPhone 3G S ran about twice as fast as the 2g Touch in every test</strong></p>
<p>The results are specific to our own application and are definitely not all-inclusive, but the figure is still significant and interesting. I haven't updated any of the code to take advantage of the OpenGL ES 2.0 features, so this is simply comparing ES 1.1 performance on the two platforms.</p>
<p>The somewhat faster, next-generation CPU obviously should make a difference, but it looks like the PowerVR SGX has a very significant performance gain over the MBX.
</p>
<p><h2>(Update)</h2>
<p>The question of the CPU contribution to performance was nagging at me, so I dug up the C source code for the <a href="http://math.nist.gov/scimark2">Scimark2</a> benchmark suite from NIST and put together a quick test application for the iPhone.  Scimark2 is a set of numerically intensive tests including FFTs, successive over relaxation (SOR), Monte Carlo calculations, matrix multiplications and LU decomposition - calculations similar to the ones we do in our application.</p>
<p>
I ran the test on the Touch and the 3gs with both small and large (cache-blowing) datasets to see how they compared.  Here are the results:
</p>
<p>
iPhone 3Gs:&nbsp;&nbsp;&nbsp;&nbsp;6.42 Mflops (small dataset)&nbsp;&nbsp;5.86 Mflops (large dataset)<br />
2g Touch:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5.21 Mflops (small dataset)&nbsp;&nbsp;4.86 Mflops (large dataset)
</p>
<p>
In these tests the 3G S comes out about 20% faster than the 2g Touch.  Given that the clock speed of the 3G S is only about 12% faster, there is definitely some extra oomph coming from the upgraded processor architecture, but I think it's pretty clear that the PowerVR SGX's contribution to our performance increase is substantial.</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/244/early-iphone-3g-s-opengl-test-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WWDC Press</title>
		<link>http://blackpixel.com/blog/220/wwdc-press/</link>
		<comments>http://blackpixel.com/blog/220/wwdc-press/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 18:57:40 +0000</pubDate>
		<dc:creator>Chris Clark</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=220</guid>
		<description><![CDATA[
Last week Bil, Dan, George, Kyle, and I took a trip down to San Francisco, a town inexplicably colder than Seattle at this time of year, to attend Apple's Worldwide Developer Conference. It's a week of sessions delivered by Apple engineers, developer labs, the keynote (of course) and a chance to give our colleagues in [...]]]></description>
			<content:encoded><![CDATA[<div style="float:right;margin-left:20px"><object width="460" height="283"><param name="movie" value="http://www.youtube.com/v/pb3bh_aRjDc&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/pb3bh_aRjDc&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="460" height="283"></embed></object></div>
<p>Last week Bil, Dan, George, Kyle, and I took a trip down to San Francisco, a town inexplicably colder than Seattle at this time of year, to attend Apple's <a href="http://developer.apple.com/wwdc/">Worldwide Developer Conference</a>. It's a week of sessions delivered by Apple engineers, developer labs, <a href="http://www.apple.com/quicktime/qtv/wwdc09/">the keynote</a> (of course) and a chance to give our colleagues in the Mac and iPhone community a sneak peek at what we're working on.</p>
<p>While we were there, Kyle had a chance to <a href="http://www.forbes.com/2009/06/08/iphone-apple-developers-technology-personal-tech-developers.html">give Forbes' Brian Caulfield his impressions</a> of the keynote and a quick demo of <a href="http://blackpixel.com/blog/140/tatooine/">Tatooine</a>, and later in the week we sat down with The Unofficial Apple Weblog to give them a peek too. Here's the video.</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/220/wwdc-press/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Code Name: Tatooine</title>
		<link>http://blackpixel.com/blog/140/tatooine/</link>
		<comments>http://blackpixel.com/blog/140/tatooine/#comments</comments>
		<pubDate>Fri, 29 May 2009 05:28:57 +0000</pubDate>
		<dc:creator>Chris Clark</dc:creator>
				<category><![CDATA[iPhone Dev]]></category>

		<guid isPermaLink="false">http://blackpixel.com/?p=140</guid>
		<description><![CDATA[
We have a lot of Star Wars memorabilia floating around the Black Pixel offices. Our doorman, Boba, greets guests and welcomes them aboard while model TIE fighters and Republic attack gunships crowd spare shelves and desks.
Which is why our projects take on a little Jedi flavor, too. And right now, a little project by the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blackpixel.com/wp/wp-content/uploads/2009/05/tatooine-default.jpg"><img src="http://blackpixel.com/wp/wp-content/uploads/2009/05/tatooine-default.jpg" alt="" title="" width="105" height="185" /></a></p>
<p>We have a lot of Star Wars memorabilia floating around the Black Pixel offices. <a href="http://www.flickr.com/photos/dlpasco/729296415/">Our doorman, Boba</a>, greets guests and welcomes them aboard while model TIE fighters and Republic attack gunships crowd spare shelves and desks.</p>
<p>Which is why our projects take on a little Jedi flavor, too. And right now, a little project by the name of Tatooine has our full attention. You remember Tatooine—it’s that desert planet. The one scorched by twin suns. Luke grew up there! He met Han at the cantina in Mos Eisley! You know the one.</p>
<p>So you wanna see something neat? How about a super <a href="http://blackpixel.com/wp/wp-content/uploads/2009/05/tatooine-default.jpg">sneak-peek at Tatooine</a>? Okay, I admit that’s a total tease. But there’ll be more to see at WWDC, June 8-12 in San Francisco. We hope to see you there.</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/140/tatooine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Black Pixel Welcomes Kyle Kinkade</title>
		<link>http://blackpixel.com/blog/113/black-pixel-welcomes-kyle-kinkade/</link>
		<comments>http://blackpixel.com/blog/113/black-pixel-welcomes-kyle-kinkade/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 17:01:33 +0000</pubDate>
		<dc:creator>Daniel Pasco</dc:creator>
				<category><![CDATA[biz]]></category>

		<guid isPermaLink="false">http://blackpixel.com/blog/?p=113</guid>
		<description><![CDATA[
We are pleased to announce that Kyle Kinkade has accepted a position on the Black Pixel team!
As of this morning, Kyle has officially assumed the roles of Senior iPhone Developer and Executive Vice President. Kyle brings with him direct experience and deep strategic understanding of the iPhone application market, along with formidable expertise in technologies [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blackpixel.com/blog/wp-content/uploads/2009/04/kyleisamac.jpg" alt="Kyle poses" width="240" height="332" /></p>
<p>We are pleased to announce that <a href="http://omglolh4x.com/">Kyle Kinkade</a> has accepted a position on the Black Pixel team!</p>
<p>As of this morning, Kyle has officially assumed the roles of Senior iPhone Developer and Executive Vice President. Kyle brings with him direct experience and deep strategic understanding of the iPhone application market, along with formidable expertise in technologies such as Cocoa, Objective C, and Core Animation.</p>
<p>Kyle joins us from <a href="http://tapulous.com">Tapulous</a>, where he worked on Tap Tap Revenge 2, the latest in the massively popular TTR series, which had over 150,000 downloads in its first 24 hours and reigned as the top free game on Apple's iTunes App Store.  Prior to working at Tapulous, he worked as the Director of Mobile Development at <a href="http://gettyimages.com">Getty Images</a>.</p>
<p>As a part of the Black Pixel management team, Kyle will help define our product roadmap and participate in strategic planning.</p>
]]></content:encoded>
			<wfw:commentRss>http://blackpixel.com/blog/113/black-pixel-welcomes-kyle-kinkade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
