4

I'm not sure if this question has been asked already, my stackoverflow-fu has failed me.

So I'm building an OpenGL-ES-based iPhone game and pretty much all of the examples I've found out in the wild are on OpenGL ES 1.x. Which is fine because at least I'm (re)learning a lot about OpenGL in general.

Now that newer devices support OpenGL-ES 2.0, I'm wondering if anyone has ported their OpenGL-ES 1.x app to 2.0 and if so were there any performance or efficiency gains? For instance, I can setup my lighting (in 1.x) with glLightf(blahblah) and I'm done with lighting...but apparently that function doesn't exist in 2.0 so I'm forced to write it myself? So, how can somebody with no experience "programming the pipeline" accomplish this? Is there a default lighting implementation in 2.0?

I'm probably speaking out of ignorance as I haven't really found any solid iPhone-specific OpenGL-ES 2.0 information.

Any help in this space will be greatly appreciated.

Tim Reddy
  • 4,340
  • 1
  • 40
  • 77

1 Answers1

3

From what I've read, and from my limited time working with it, going to OpenGL ES 2.0 from 1.1 isn't so much a matter of performance as it is about capabilities. If you watch the Mastering OpenGL ES for iPhone videos (part of the iPhone Getting Started Videos available through the iPhone Developer Program site), Apple even states that if you can do what you need to under OpenGL ES 1.1, you don't need to step up to 2.0.

OpenGL ES 2.0's fully programmable pipeline can make simple actions much harder than doing the same thing in 1.1, because you need to write code for parts of the pipeline that were handled for you before. However, 2.0 makes practical many stunning effects that you just couldn't do in 1.1. For example, I recommend watching the WWDC 2010 session video 417 - OpenGL ES Shading and Advanced Rendering and the Graphics and Media State of the Union to see what's possible using OpenGL ES 2.0.

To date, few applications have used OpenGL ES 2.0, given the limited subset of iPhone devices that had compatible GPUs and the lack of documentation and examples. I think we'll see this start to change as the pre-iPhone 3G S devices are phased out. In particular, the iPad has had OpenGL ES 2.0 from launch, so if you are designing an application for it you can rely on these capabilities to be there. More code examples and documentation are sure to appear in the near future.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
  • Thanks for the explanation, unfortunately I couldn't find a track labeled "Mastering OpenGL ES for iPhone" video via the getting started link you provided...the WWDC tracks I did find. In your research, have you found any info regarding deprecating OpenGL-ES 1.x on future iOS devices? – Tim Reddy Jul 21 '10 at 18:57
  • @T Reddy - Look under the "Advanced Videos" track in iTunes when you click on the Getting Started Videos link. The two videos I refer to are there. As far as deprecation, I see no reason why they would any time soon. OpenGL on the desktop still supports all the functions of old. – Brad Larson Jul 21 '10 at 19:47
  • The lack of examples exists because ES2 is 100%-shaders based. If you study about shader (on any OpenGL-ish language), you get it all. The hard part is finding the right algorithm (ex: how to do directional lights? htd an ortho view?). I'm planning to support mixed ES1/2 codes, but the costs of newer iOS devices in Brazil is prohibitive (and the simulator is not enough). – Eduardo Costa Mar 05 '11 at 21:36
  • @Eduardo - There are some things that are different in the implementation of shaders in OpenGL ES 2.0 vs. desktop OpenGL, so it's not just that people can fall back on OpenGL references that held back good examples. However, this answer is somewhat outdated at this point, and my more recent answer here more accurately reflects the current state of things: http://stackoverflow.com/questions/4784137/choose-opengl-es-1-1-or-opengl-es-2-0/4787667#4787667 . In fact, I taught an entire class on the use of OpenGL ES 2.0, so it's definitely becoming more mainstream. – Brad Larson Mar 06 '11 at 03:02