The cube can be rotated and zoomed by touch. I didn’t make the cube stop on the near and far boundaries, so you can zoom right into the center of the cube if you like.
The last four chapters of this tutorial series are written, and just need to be converted into WordPress pages, which I’ll be working on over the next few days.
For now, I thought it might be useful to make the Xcode 4 project available in case you didn’t care about the tutorial and just wanted to see the final code.
The Xcode project can be downloaded right here: EDCubeDemo.zip
As always, comments are welcomed, and happy programming!
Part Thirteen: Rendering Textures has been published. Don’t forget to either download the project code or grab an image to use with the code before you try to build and run the changes.
You can also just right-click on the Apple logo graphic at the top of the chapter and ‘Save As…’.
In Part Eleven: The Rotation Matrix, I forgot to clear the temporary matrix used for the individual rotation matrices before each operation. If there was only one rotation operation, there were no problems, since the temporary matrix was being set to identity at the top of the method. However, I should have been applying the identity matrix in each conditional block of axis rotation process instead of just once at the top of the method.
The code has been fixed and the associated zip files have been updated. I apologize for any problems that this might have caused.
Parts eleven and twelve have been published. Together, they deal with the rotation matrix and the projection matrix. The next chapter will deal with textures, and then after that we will go 3D with a cube.
Part Ten: Matrix Tools has been published, and examples how to create a utility class to house common matrix manipulation code.
Please keep in mind that the example code in this tutorial is primarily for educational purposes, and not performance. I’m sure that there are much higher-performance libraries available for working with matrices in OpenGL ES, but the focus of this tutorial is to show what the code actually does, and how it does it.
Understand that, and you’ll be able to grab any existing utility code in C or C++ and have no trouble integrating it properly in your future OpenGL ES 2.0 projects on the iPhone.
There is a fantastic course online that covers matrix math in great detail at http://programmedlessons.org/VectorLessons/vectorIndex.html. If you’re mathematically inclined, and/or are interested in programming matrices in OpenGL, you should go through the course. It was a great help to me in figuring out some of the nasty little details of successfully working with all of these matrices in OpenGL.
Part Six: Making Some Changes is now published, and I have added links to download the project code after each step, starting with step five. The part five project download is basically what comes straight out of Xcode 4, but from part six on, the project zip files will contain all of the changes from the associated part of the tutorial.
Part seven will deal with matrices in great detail, so it’ll be a few days before it’s ready, but it’ll be worth the wait.
I have published the first five parts of my OpenGL ES 2.0 on the iPhone tutorial. The first few parts are introductory and go over general OpenGL information and creating your OpenGL ES 2.0 project in Xcode 4.
Parts four and five, however, attempt to dive pretty deep into the structure and process flow of the actual template code generated by Xcode 4. I’ve proofread all of the parts, and I’m reasonably sure that I’ve worded everything correctly, but if you find anything that looks unclear or wrong, please let me know.
Otherwise, enjoy! I’ve learned a lot putting this together, and I hope you find it useful too. I’ll be adding more parts as I finish putting together the tutorial to take the Xcode OpenGL ES shell code and build it out with a 3D rotating cube, lighting effects, and perspective.
I have finally finished my analysis of the Xcode 4 Open GL ES 2.0 Application project template. Over the next few days, I will be uploading the complete analysis, and welcome any comments on the work.
My goal with this project is to create a complete, definitive walkthrough and tutorial for getting started with OpenGL ES 2.0 on the iPhone using Xcode 4.