As I strove to learn OpenGLES 2.0 for new gaming projects on iPhone and Palm Pre, I faced certain challenges due to the introduction of a programmable graphics pipeline in OpenGLES 2.0. With this mechanism, we are responsible for writing the code to generate our graphics, which was overwhelming at first. To help others, I ported some of the NeHe tutorials over to OpenGLES2.0 on iPhone in an easily-digestible way. In this post, you will find a walkthrough of the first 4 tutorials, complete with codes, explanations and screenshots to make learning easier.
This tutorial guides you through applying textures to a rotating 3D cube using OpenGL. We will be utilizing the esUtils code, specifically its function esGenCube, and modify our shaders to accommodate our texture coordinates. After setting up our new mvp matrix and position vertex attribute, we will apply a texture to our rotating cube. The code can be found via a provided link.
In this blog post, I delve into the specifics of porting code for drawing 3D shapes in ES2.0. I detail how to overcome the lack of depth buffer in the default OpenGL template and describe how to add rotation to objects by saving the model view matrix. This post offers a useful walkthrough, especially for those keen to deepen their understanding of 3D rendering nuances in ES2.0.