Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm fairly new to anything OpenGL in general. I've made an OpenGL ES 1.1 based 2D iPhone game by working from sample code. I'm under the impression that OpenGL ES 2.0 is substantially different from 1.1. So what does updating 1.1 code to 2.0 entail?

I'm accustomed to the kinda basic drawing pattern of "push matrix, translate, rotate, draw 2D texture, pop matrix". What's the "equivalent" in 2.0?

share|improve this question
add comment

4 Answers

up vote 9 down vote accepted

OpenGL ES 2.0 is very different from ES 1.1. You don't have a fixed-function pipeline anymore, so your familiar "push matrix, translate, rotate", etc are all gone.

Instead, you have the concept of shaders: vertex and fragment. They're little programs that get executed for each vertex and each pixel. That's where all the transformation and other effects happen. Your code will prepare the vertex data, tell OpenGL how it's structured, and hand it over to the shaders.

But not all is lost: Some parts of OpenGL haven't changed, like setting different states (blending modes, depth comparisons) or creating textures.

To use OpenGL ES 2.0 effectively you need to master the basics of 3D computer graphics, so get a good intro book and learn the principles. Then you can move on to OpenGL ES 2.0 and start writing shaders. This is a good OpenGL ES 2.0 book.

Finally, don't assume you have to move to OpenGL ES 2.0. Unless there's something specific you need that you can't do in ES 1.1, you can continue using ES 1.1 because newer devices are all backwards compatible.

share|improve this answer
2  
Push matrix, translate, rotate, etc. are all still there. It's the immediate mode drawing that's gone. So no more glVertex() glNormal() etc. You need to use vertex arrays or vertex buffer objects to get your geometry to the card instead. –  Bob Somers Jul 26 '10 at 0:21
3  
@Bob Somers I'm pretty sure the matrix stack was removed in OpenGL 2.0 ES on the iPhone, so there isn't push matrix, translate, etc.. –  5ound Jul 26 '10 at 3:28
    
Hmm, I must admit I'm not 100% sure, since I really don't do OpenGL for mobile that much, and definitely not for iPhone. I would think the matrix stack has to be there, though. How would you instance geometry without it? –  Bob Somers Jul 26 '10 at 6:38
    
@Bob Your comment would be accurate if you were comparing OpenGL ES 1.1 to OpenGL 1.5. ES 2.0 is a completely different beast and the matrix operations are indeed gone. Of course there are plenty of places you can pick up library of C++ matrix classes. –  U62 Jul 26 '10 at 12:32
    
@Bob Somers: you instance geometry by passing matrix uniforms that you computed yourself to vertex shaders (the so called Model-view matrix). –  Bahbar Aug 5 '10 at 11:30
show 1 more comment

I have ported my 3D Engine from OpenGL ES 1.X to OpenGL ES 2.X because i love shaders. The renderers are distincts and don't share any code.

You can translate easily:

  • textures management
  • framebuffer objects
  • blending

More difficult (Need shaders):

  • fixed pipeline transformations (rotation, scale ...)
  • fog
  • lighting

To port your code, i recommand you:

Step One

  • learn GLSL 1.2: you can read WebGL tutorials
  • try to write some shaders shader toy

Step Two

  • list all material you have (or rendering technics)
  • list all vertices informations as vertices coordinates, normal, textures coord, color informations you need for each material

    With theses informations, you will know which GLSL Programs (vertex + fragment shaders) you must write.

Step Three

  • write your shader compil functions and log each informations
  • implement a minimal program OpenGL ES 2.X with a quad (two triangles)
  • implement and test your GLSL programs one by one

Step Four: Optimize

share|improve this answer
add comment

OpenGL ES 2.0 is not a new revision of OpenGL ES 1.1. Or in other words, OpenGL ES 2.0 is not a better OpenGL ES 1.1.
Well no duh, they changed everything.

The import of that simple statement is easy to overlook. Consider:
OpenGl 2.0 is a new revision of OpenGL 1.5. OpenGL 2.0 is a better OpenGL 1.5.

This means If you're using OpenGl 1.5 and want to maintain forward compatibility you should move to 2.0.

The same is not true of OpenGL ES. 1.1 was not superseded by 2.0. They are different standards. The confusion might have been eliminated if they had been named:

  • OpenGL ES fixed
  • OpenGL ES shader

NOTE: technically this isn't perfectly true. The reason being, you could implement the 1.0 series with the 2.0 series. You'd just have to set the fixed pipeline functions as shaders.

share|improve this answer
add comment

As an aside to the other answers here, I recently found gles2-bc, a C++ library 'which makes the non-backward compatible OpenGL ES 2.0 API backward compatible'.

There are some known limitations and I haven't used it myself, but thought I'd post the link for reference.

http://code.google.com/p/gles2-bc/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.