As promised this is the Nehe OpenGL tutorial 2 converted to run onthe iPhone.
You can download my Xcode project file here: Nehe Tutorial #2 Converted To iPhone
Now, I won’t get into the specifics as we move along, but I will give a breakdown of the steps I took in creating this tutorial.
1. Created an OpenGL ES project in Xcode.
2. Looked through the C++ version of the Nehe code, and placed the draw code into the Xcode project.
3. Added in missing GLU functions by taking them out of the GluES library, and removing any asm calls.
4. Placed the triangle and square vertices into a vertex array.
5. Placed the shapes a little further back to adjust for the iPhone’s portrait view.
And that’s it! I will get into more details as we move along, and I suggest that you look through all the code, and try to find what’s different.
See you later!
PS. You can check out Jeff Lamarche’s Nehe Tutorial 2 conversion on the Iphone here. His approach was different from mine, as he recreated it all from the ground up while I used every resource I could find since I’m all about speed of implementation.
I’ve been asked this question a few times by users here so I just wanted to post my thoughts on this subject. Out of the many choices, there really are few good books for the absolute beginner to get started with iPhone development. The main reason is most will assume an understanding of Objective-C and some experience programming for Mac OS X.
In my opinion most of the best resources for beginning iPhone development are free, but you have to understand that to truly do this stuff you will have to at least know something about Objective-C and Object Oriented programming. If you want to get into 3D game programming on the iPhone (which some of you have messaged me about) you will need to know something about Opengl ES, and that is a completely different matter.
Apple has their getting started documentation which is pretty good itself, and better than most books. Often, I’ve found that books will simply copy the apple documentation simply making slight modifications to examples and then distributing as their own. Learning to use and understand the apple documentation is very important as any new functionality will be explained here long before it is in a book. I suggest you attempt to go through this documentation before you spend a dime on any book.
An excellent free book I’ve found is BecomeAnXcoder. While this book does not get into iPhone development, it does get into developing with Xcode using Objective-C, and once you can understand this the transition to developing for the iPhone is fairly simple.
Now, if you must purchase a book I suggest Programming Objective-C 2.0 2nd edition (2nd edition adds iPhone development). This book starts from the very beginning, brings you through the basics of Objective-C, Object Oriented Programming, XCode, and iPhone programming. In my opinion this is one of the few books on this topic actually worth the money, and from there you can continue on into Apple’s iPhone code.
That’s it for my recommendations. Of course, you can also keep coming back to this website for more Objective-C and iPhone development information.