Now that the NDA on the iPhone OS 3.0 SDK has been lifted (which happened much faster than what I thought it would take!) here’s my first contribution to the world of iPhone OS 3.0 open source code: sample code about how to use OpenGL ES 2.0 on the iPhone 3GS, something I announced in Twitter last week.
As you might know by now, one of the biggest enhancements (and yet, one of the most obscure) of the newly released iPhone 3GS is the new GPU chipset, which allows developers to create applications using Open GL ES 2.0 (together with Open GL 1.1, which was already available in the first two iterations of the iPhone). This is a major advance, invisible to the end user, which, coupled with the unprecedented performance boost of the iPhone 3GS, opens up the possibility to developers to create applications with new textures and effects, yet unforeseen on this platform.
Given that Xcode does not (yet) bring an Xcode template to play with, and that the OpenGL ES 2.0 Programming Guide book, by Aaftab Munshi, Dan Ginsburg and Dave Shreiner does not (obviously) bring iPhone examples, I have created a project in Github where I will be publishing the code samples in the book, as I progress in the lecture, ordered by chapter, ready to compile and play with.
Enjoy! I’m happy not having to use the word “[REDACTED]“ any more now (there’s the other OS, the bigger cat, but, oh well…)
Update, 2009-06-24: I just found this blog post by the folks of Black Pixel (Daniel Pasco’s company) with benchmarks about OpenGL ES on the iPhone 3GS… and the first line says it all:
Holy crap, this thing is fast
Update, 2009-06-24: Jeff LaMarche just announced that the authors of the book have published iPhone – compatible code in the book website! That effectively renders this project useless :))
Similar Posts:

20 Comments
06.24.2009
Nice dude!
And have fun with chapter 3 :)
06.24.2009
Cool! I’ve bought the book some months ago and recogized, that my iPhone only has ES 1.1! :) Now we can use it! Cool dude! Have fun writing code!
06.24.2009
Is OpenGL ES 2.0 on all iPhones with 3.0, or just 3GS?
06.24.2009
Only 3GS. OpenGL ES 2.0 is a significate changeset to ES 1.1 and ES 2.0 need a different Chipset.
06.24.2009
The supported version of OpenGL ES is GPU-dependent, as far as I understand, so no, you only get 2.0 when running apps on the 3GS. The code I posted on Github, when run on an iPhone 3G, doesn’t show anything (just tried :)
06.24.2009
Interesting, is there a way to say “this app requires iPhone 3GS hardware” in the app store? Or do you just have to code around that, supporting the iPhone 3G with OpenGL ES 1.1 and iPhone 3GS with OpenGL ES 2.0?
06.24.2009
Depending on what you want to do, internally your app should have a couple of #ifdef / #else / #endif wrapping portions of code for each version. However, if you plan to target the 3G, you might as well just type OpenGL ES 1.1 code… which is already a complex task per se. I think that the App Store filters what you see depending on your OS / Device, but again, I’m not sure.
06.24.2009
When you submit your app with itunesconnect you can choose the compatible devices. So its possible to build against 3.0 and only deploy it to 3GS.
J
06.25.2009
there you go :) thanks Jonas!
07.01.2009
Hi everyone! I just updated this post with a link to sample code provided by the authors of the book… you might want to check it out at http://opengles-book.com/downloads.html#iPhone :) cheers!
07.10.2009
Extra credit for someone out there: Get rid of all the warnings and other gotchas in their sample code!
07.16.2009
@Joe hey that’s the minimum every project should achieve: 0 warnings. This is part of programming “hygiene” :)
07.16.2009
Hear hear!! Note: By “their” I meant the book authors (or whoever did the porting to iPhone OS).
07.16.2009
Sure, anyway your comment inspired my latest post :) Enjoy!
07.16.2009
Oh! No way! Wow. :-D
[Joe shuffles off to read it ...]
08.10.2009
Hi, I am new on openGL so please help me how i can create application using it.
Thanks in advance..
08.13.2009
I found that it is extremely frustrating and obscuring to read your text that is full of hyperlinks.
08.17.2009
@Alien
Sorry! You can subscribe to my RSS feed and read the articles from your favorite black-text-over-white-background-with-blue-links RSS reader.
Cheers!
08.17.2009
OpenGL ES 2.0 is really cool, I love writing those funny shaders, I did a quick ocean implementation on the iPhone and it looks like this : http://www.youtube.com/watch?v=PnnCzN0ufPI
11.28.2009
[...] recent comment by Joe D’Andrea in a previous post reminded me about the importance of removing compiler [...]
Commenting