Intro to iPhone OpenGL ES

There are two paths into OpenGL ES on the iPhone. You can bite the bullet and create an Xcode project by selecting the template “OpenGL ES Application” rather than “Window-based Application”. This will create the app with the bouncing square. Here is a .zip file of this project and a commentary on its major files: the application delegate, the view controller, the eagle view, and the two little shader programs.

Or you could download two .zip files containing two dozen files from the home page of the OpenGL SuperBible. Use them to make a simple program that runs on a Mac. Then port the program to the iPhone. It draws a stationary red triangle on a blue background.

The advantage of using the SuperBible is that you only have to concern yourself with one file, Triangle.cpp. The other files—the view controller and the eagle view—require only trivial modifications to accomodate Triangle.cpp.

The disadvantage of the SuperBible is that you have to add many .cpp and .h files to your project, and even one lib.a file. But I have already created a project for you here containing all of these files, plus Triangle.cpp. You can help yourself to the .zip file of this project, modify Triangle.cpp, and leave the other files untouched.