Hi everyone, sorry about the frequency of posts as of late, I was out of town for a few days, and accepted a ft position for the next couple of months, so I am currently overwhelmed.
Something I’ve been looking into mainly for testing purposes is push notification. Now, push notification can really mess up an app so you have to be able to deal with it.
Creating a push notification server can be complex especially if you’re not a web developer.
I found this great tutorial here:
Push Notification Server Tutorial
Which does a great job of showing how it’s done.
Continuing where I left off yesterday I will describe some of the potential hangups when converting OpenGL code to OpenGL ES. The first thing I noticed when trying to convert some OpenGL code to the iPhone’s OpenGL ES was that on the iPhone there is no glVertex function. Instead of glVertex you will need to use a vertex array. I’ll give an example from Nehe Tutorial #2.
For example, in Nehe OpenGL tutorial #2 you see the lines:
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
What these lines do is create a triangle with the vertices specified through the glVertex3f function (3 dimensional locations).
In OpenGL ES the glBegin and glEnd, and glVertex functions do not exist, the above lines would be rewritten using a vertex array.
In my remake of the Nehe Tutorial #2 for iPhone this is done using the following lines:
0.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f
glVertexPointer(3, GL_FLOAT, 0, triangleVertices);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
Here, an array is created, and then in order to draw the array we:
1. use glEnableClientState to enable use of a vertex array
2. use glVertexPointer to specify the size, datatype of the points stored in the array, and name of the array.
3. use glDrawArrays to draw the vertex array, in this case using the 3 points to draw a connected triangle.
Now you can see that this code provides the exact same result, just in OpenGL ES they’ve removed all redundancies so you need to use vertex arrays, and the glBegin, and glEnd semantics are removed. Next I’ll be exploring the differences using perspective functions in OpenGL ES.
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.