OpenGL ES 2.0 on iPhone OS 3.0

Date Arrow  June 24, 2009

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:

Tagged   Open Source · iPhone

20 Comments

  • #1.   Marc
    06.24.2009

    Nice dude!
    And have fun with chapter 3 :)

  • #2.   Jonas
    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!

  • #3.   Paul Barry
    06.24.2009

    Is OpenGL ES 2.0 on all iPhones with 3.0, or just 3GS?

  • #4.   Jonas
    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.

  • #5.   Adrian
    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 :)

  • #6.   Paul Barry
    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?

  • #7.   Adrian
    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.

  • #8.   Jonas Schnelli
    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

  • #9.   Adrian
    06.25.2009

    there you go :) thanks Jonas!

  • #10.   Adrian
    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!

  • #11.   Joe
    07.10.2009

    Extra credit for someone out there: Get rid of all the warnings and other gotchas in their sample code!

  • #12.   Adrian
    07.16.2009

    @Joe hey that’s the minimum every project should achieve: 0 warnings. This is part of programming “hygiene” :)

  • #13.   Joe
    07.16.2009

    Hear hear!! Note: By “their” I meant the book authors (or whoever did the porting to iPhone OS).

  • #14.   Adrian
    07.16.2009

    Sure, anyway your comment inspired my latest post :) Enjoy!

  • #15.   Joe
    07.16.2009

    Oh! No way! Wow. :-D

    [Joe shuffles off to read it ...]

  • #16.   Surendra
    08.10.2009

    Hi, I am new on openGL so please help me how i can create application using it.
    Thanks in advance..

  • #17.   Alien
    08.13.2009

    I found that it is extremely frustrating and obscuring to read your text that is full of hyperlinks.

  • #18.   Adrian
    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!

  • #19.   nuclear bit
    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

  • #20.   Objective-C Compiler Warnings | akosma software
    11.28.2009

    [...] recent comment by Joe D’Andrea in a previous post reminded me about the importance of removing compiler [...]

Commenting