<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: iPhone Game Programming &#8211; Tutorial 10 &#8211; Game Structure</title>
	<atom:link href="http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/</link>
	<description>iPhone Game Development - Web Development</description>
	<lastBuildDate>Sat, 04 Feb 2012 20:13:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Brenton</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-27/#comment-7303</link>
		<dc:creator>Brenton</dc:creator>
		<pubDate>Wed, 14 Sep 2011 05:51:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-7303</guid>
		<description>Hi Harold... (and everyone else who has had the striped gradient issue....)

I think I may have solved it as I was experiencing the same issue... FOR AGES!!

Anyway, in Texture2D.m go to the method: - (id)initWithImage:(UIImage *)uiImage filter:(GLenum)filter {}

In here there is a section setting the pixelFormat based on the transparency of the image. As my image has no transparency it was forcing it to be kTexture2DPixelFormat_RGB565 regardless if I set the drawableProperty to kEAGLColorFormatRGBA8 in EAGLView.m init()

In my testing I commented out the code so that everytime it was using kTexture2DPixelFormat_RGBA8888 and it solved my problem.. I&#039;m not certain about any performance hits due to this change, however I didn&#039;t need to alter my image any further than a normal PNG save from Photoshop and it works (for my example at least) so I&#039;m happy with that.

if(CGImageGetColorSpace(image)) {
// if(hasAlpha) {
       pixelFormat = kTexture2DPixelFormat_RGBA8888;
// }
// else {
//    pixelFormat = kTexture2DPixelFormat_RGB565;
// }

Good luck with your project(s).

Thanks Mike for your tutes, they&#039;ve been very helpful!

Bren10</description>
		<content:encoded><![CDATA[<p>Hi Harold&#8230; (and everyone else who has had the striped gradient issue&#8230;.)</p>
<p>I think I may have solved it as I was experiencing the same issue&#8230; FOR AGES!!</p>
<p>Anyway, in Texture2D.m go to the method: &#8211; (id)initWithImage:(UIImage *)uiImage filter:(GLenum)filter {}</p>
<p>In here there is a section setting the pixelFormat based on the transparency of the image. As my image has no transparency it was forcing it to be kTexture2DPixelFormat_RGB565 regardless if I set the drawableProperty to kEAGLColorFormatRGBA8 in EAGLView.m init()</p>
<p>In my testing I commented out the code so that everytime it was using kTexture2DPixelFormat_RGBA8888 and it solved my problem.. I&#8217;m not certain about any performance hits due to this change, however I didn&#8217;t need to alter my image any further than a normal PNG save from Photoshop and it works (for my example at least) so I&#8217;m happy with that.</p>
<p>if(CGImageGetColorSpace(image)) {<br />
// if(hasAlpha) {<br />
       pixelFormat = kTexture2DPixelFormat_RGBA8888;<br />
// }<br />
// else {<br />
//    pixelFormat = kTexture2DPixelFormat_RGB565;<br />
// }</p>
<p>Good luck with your project(s).</p>
<p>Thanks Mike for your tutes, they&#8217;ve been very helpful!</p>
<p>Bren10</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-27/#comment-7162</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 27 Jun 2011 15:28:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-7162</guid>
		<description>Is Part 2 ever going to be released Mike?</description>
		<content:encoded><![CDATA[<p>Is Part 2 ever going to be released Mike?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lalit</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-27/#comment-7156</link>
		<dc:creator>lalit</dc:creator>
		<pubDate>Mon, 20 Jun 2011 20:38:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-7156</guid>
		<description>this tutorial is awesome..love to see more</description>
		<content:encoded><![CDATA[<p>this tutorial is awesome..love to see more</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-27/#comment-4694</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Tue, 28 Dec 2010 00:12:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4694</guid>
		<description>Just a quick question:

I&#039;ve been trying to make new maps for the game in this tutorial.

I&#039;ve been changing the tmx file just find. Now i&#039;m trying to change the start location of the player, and the camera.

What pieces of code do i need to change to accomplish this? I&#039;ve spent some time searching, but nothing seems to work consistantly.

Thanks!

Jeff</description>
		<content:encoded><![CDATA[<p>Just a quick question:</p>
<p>I&#8217;ve been trying to make new maps for the game in this tutorial.</p>
<p>I&#8217;ve been changing the tmx file just find. Now i&#8217;m trying to change the start location of the player, and the camera.</p>
<p>What pieces of code do i need to change to accomplish this? I&#8217;ve spent some time searching, but nothing seems to work consistantly.</p>
<p>Thanks!</p>
<p>Jeff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harold</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-27/#comment-4325</link>
		<dc:creator>Harold</dc:creator>
		<pubDate>Fri, 29 Oct 2010 21:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4325</guid>
		<description>Hi Mike,

Thank you for your response.

I&#039;ve already tried that before and it didn&#039;t work. Looks exactly the same. Do you think it has something to do with the performance?

I&#039;m only running one map and two images and the FPS is really high. (Or is that not related?)

I&#039;ve also been trying to export the image differently. It always looks fine in Finder but stripy when rendered. Strange.. 

Do you (or anyone else) have any other ideas? Does is have to do with some kind of color scheme that&#039;s not appropriate for subtle gradients? Does anyone else have problems with this?

Anyway if I find out, I&#039;ll let you know.

Harold</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Thank you for your response.</p>
<p>I&#8217;ve already tried that before and it didn&#8217;t work. Looks exactly the same. Do you think it has something to do with the performance?</p>
<p>I&#8217;m only running one map and two images and the FPS is really high. (Or is that not related?)</p>
<p>I&#8217;ve also been trying to export the image differently. It always looks fine in Finder but stripy when rendered. Strange.. </p>
<p>Do you (or anyone else) have any other ideas? Does is have to do with some kind of color scheme that&#8217;s not appropriate for subtle gradients? Does anyone else have problems with this?</p>
<p>Anyway if I find out, I&#8217;ll let you know.</p>
<p>Harold</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-26/#comment-4323</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Fri, 29 Oct 2010 18:14:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4323</guid>
		<description>Hi Harold

Something else to check is the colour depth that has been set within EAGLView.m. The following command is in the init method for EAGLView.m file.
&lt;pre&gt;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
		[NSNumber numberWithBool:FALSE], 
	        kEAGLDrawablePropertyRetainedBacking, 
		kEAGLColorFormatRGB565, 
		kEAGLDrawablePropertyColorFormat, 
		nil];
&lt;/pre&gt;

You&#039;ll see that the color format being set is kEAGLColorFormatRGB565. Try changing that to kEAGLColorFormatRGBA8. RGB565 gives you 16bit color depth while RGBA8 gives you 32bit. If you can get away with the reduced color depth it does give you a small boost in performance. I&#039;m thinking the stripping could be down to the color depth being used.

Let me know how it goes.

Mike</description>
		<content:encoded><![CDATA[<p>Hi Harold</p>
<p>Something else to check is the colour depth that has been set within EAGLView.m. The following command is in the init method for EAGLView.m file.</p>
<pre>
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
		[NSNumber numberWithBool:FALSE],
	        kEAGLDrawablePropertyRetainedBacking,
		kEAGLColorFormatRGB565,
		kEAGLDrawablePropertyColorFormat,
		nil];
</pre>
<p>You&#8217;ll see that the color format being set is kEAGLColorFormatRGB565. Try changing that to kEAGLColorFormatRGBA8. RGB565 gives you 16bit color depth while RGBA8 gives you 32bit. If you can get away with the reduced color depth it does give you a small boost in performance. I&#8217;m thinking the stripping could be down to the color depth being used.</p>
<p>Let me know how it goes.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harold</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-26/#comment-4322</link>
		<dc:creator>Harold</dc:creator>
		<pubDate>Fri, 29 Oct 2010 14:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4322</guid>
		<description>Hmm.. it looks exactly the same with mipmapping. Strange that I couldn&#039;t find anything about this subject online.

Do you have any other ideas of what could cause this?

Harold</description>
		<content:encoded><![CDATA[<p>Hmm.. it looks exactly the same with mipmapping. Strange that I couldn&#8217;t find anything about this subject online.</p>
<p>Do you have any other ideas of what could cause this?</p>
<p>Harold</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siamak</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-26/#comment-4321</link>
		<dc:creator>Siamak</dc:creator>
		<pubDate>Fri, 29 Oct 2010 14:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4321</guid>
		<description>It does look nasty :p,
I&#039;m not sure if it would solve the problem, but implementing mipmapping is 2 min work, so worth trying it.
upon creation of your texture(in Texture2D.m) change the commented blew with new ones.

//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, filter);
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, filter);
		
		glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameterf(GL_TEXTURE_2D,GL_GENERATE_MIPMAP, GL_TRUE);</description>
		<content:encoded><![CDATA[<p>It does look nasty :p,<br />
I&#8217;m not sure if it would solve the problem, but implementing mipmapping is 2 min work, so worth trying it.<br />
upon creation of your texture(in Texture2D.m) change the commented blew with new ones.</p>
<p>//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, filter);<br />
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, filter);</p>
<p>		glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);<br />
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);<br />
		glTexParameterf(GL_TEXTURE_2D,GL_GENERATE_MIPMAP, GL_TRUE);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harold</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-26/#comment-4320</link>
		<dc:creator>Harold</dc:creator>
		<pubDate>Fri, 29 Oct 2010 13:51:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4320</guid>
		<description>@Siamak

Thanks for your fast reply!

I&#039;m using PNG but don&#039;t know alot about mipmapping. After a quick Google search, I understood that it uses a smaller version of a texture when looking from a distance.

But when I decrease the texture size, the same this still happens. Here&#039;s an example of how it looks: http://nl.tinypic.com/r/wnsqw/7

Notice the stripy-ness of the background and clouds? Since implementing mipmapping will take up some time, I wanted to make sure this problem can be fixed using mipmapping. 

So do you think this could be fixed by mipmapping or do you think there might be other issues?

Harold</description>
		<content:encoded><![CDATA[<p>@Siamak</p>
<p>Thanks for your fast reply!</p>
<p>I&#8217;m using PNG but don&#8217;t know alot about mipmapping. After a quick Google search, I understood that it uses a smaller version of a texture when looking from a distance.</p>
<p>But when I decrease the texture size, the same this still happens. Here&#8217;s an example of how it looks: <a href="http://nl.tinypic.com/r/wnsqw/7" rel="nofollow">http://nl.tinypic.com/r/wnsqw/7</a></p>
<p>Notice the stripy-ness of the background and clouds? Since implementing mipmapping will take up some time, I wanted to make sure this problem can be fixed using mipmapping. </p>
<p>So do you think this could be fixed by mipmapping or do you think there might be other issues?</p>
<p>Harold</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Siamak</title>
		<link>http://www.71squared.com/2009/07/iphone-game-programming-tutorial-10-game-structure/comment-page-26/#comment-4319</link>
		<dc:creator>Siamak</dc:creator>
		<pubDate>Fri, 29 Oct 2010 12:44:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.71squared.co.uk/?p=603#comment-4319</guid>
		<description>@Harold
Mipmapping your texture will increase the quality, as it goes for exporting, PNG works best.</description>
		<content:encoded><![CDATA[<p>@Harold<br />
Mipmapping your texture will increase the quality, as it goes for exporting, PNG works best.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

