Simple OpenGL ES 2.0 iPhone example

I had quite a hard time to find a good starting point for OpenGL ES 2.0 development on the new iPhone 3GS. That’s why I thought it might be helpful to share the simple framework I put together here.

The application is pretty much a 1-1 port of the standard OpenGL ES 1.1 example that ships with Xcode but uses shader for transforming vertices and coloring fragments. I added a ShaderProgram interface that allows to load shader from the application bundle (they have to be included in Targets -> Copy Bundle Resources.) For setting up the projection and modelview matrix I used the code available with the OpenGL ES 2.0 Programming guide [Munshi et al. 2008] but I removed all the ESContext calls because the SDK has already its own EAGLContext. One could switch out the matrix multiplication functions and add a matrix inversion routine from the vfpmathlibrary but that’s not really necessary for this simple example.

The two main function for customization are EAGLView::initView and EAGLView::updateView.

I updated WordPress and the link should work again!
Source:   shader_example.zip