Where can I find a tutorial for building a simple OpenGL app for an iPhone newbie? - iphone

I'd like to get into iPhone development (mainly OpenGL & games stuff, no GUI apps). Got 10+ years experience of thorough Windows development, mostly C++ / win32 api, some OpenGL. However I have absolutely NO experience with Mac or Apple whatsoever.
I'm confident I'll pick up the concepts without any trouble, but I got no clue where to begin, or even how to setup an iPhone development environment. Should I use GCC? or Xcode (is that an IDE and/or compiler?) and is there a step-by-step introduction somewhere to create an initial project?
There's an overkill of info and tutorials out there, but they all seem to assume some initial Mac development knowledge which I don't have. An absolute newbie tutorial on creating an OpenGL "hello world" for iPhone step by step from scratch would be awesome.
Does anyone what would be a good place to start for me?

1 -- The example projects in XCode on the Mac make excellent starting points. XCode is an IDE... and if you set the target to "simulator" it just pops up the iPhone simulator. Fire it up, you can't miss it. Download from developer.apple.com.
2 -- I really liked the book "The iPhone Developer's Cookbook: Building Applications with the iPhone SDK"
3 -- Objective C is kinda quirky but you get used to it quickly enough, plenty of web resources and books are easy to find.

I would also take a look at Stanford University's free iTunes U course in iPhone development. It's a great, thorough explanation of the iPhone platform and Objective-C. There's a "Hello World" tutorial in there, but the videos go much farther and will give you a good deep dive into the ecosystem. There is an OpenGL ES section as well.
If you haven't done so yet, you will need to either buy a Mac or build a Hackintosh, since you have to have OSX for development.

I did a test OpenGL app last fall, and found the best book for 3D on the iPhone was:
iPhone 3D Programming
By: Philip Rideout
It covers both versions of OpenGL ES that you need to be aware of if you want your apps to run on older iphone hardware, although if you only want to target the 3GS and up (and 3gen ipod touch, and ipads) then you can skip to OpenGL ES 2.
It has complete examples, a good explanation, and best of all it recognizes that a lot of people coming to the iPhone for games development already know C++, and it focuses on getting you right into the C++ OpenGL rendering loop. You have to deal with very little objective C, and most of that is well explained with examples that are easy to use.
It doesn't cover game design - it's just to get you going in 3D on iOS, so if you aren't familiar with OpenGL and game design fundamentals you should also invest in one of the many game design and opengl bibles that are available.
As far as programming the iPhone on windows, it's possible, and I have a friend doing it using a hackintosh VM. I decided to just get a cheap mac mini I found on sale when the new ones came out a few years ago. My friend found that his setup worked well enough to get to the stage where he was willing to commit to his app, then he invested money and bought a mac mini. He indicated that development just flies now, compared to his VM, and he wishes he switched sooner.
Whether you have the $500+ to invest in it is up to you, but be aware that there really aren't any other good options for iOS development yet, and you cannot easily submit apps to the apple store without a mac and xcode, so if you plan on going that route, you need to budget for a mac.

For the simplest development environment for someone starting out with iPhone development, you'll want to go with a Mac running Snow Leopard and use Xcode with the iPhone SDK. Xcode is an IDE that contains within it a modified version of the GCC (or LLVM) compiler targeted at producing Mac or iOS binaries. It also includes a full iOS simulator for quickly testing out your applications.
There are ways of doing iPhone development on Windows, but they are extremely difficult to get set up and ultimately more of a curiosity than a practical means of development
There are a good number of getting started resources listed in this question. I recommend the Stanford videos, as well as Apple's getting started videos that you can access through the iOS Dev Center. Apple also has an iOS Getting Started document that acts as a jumping-off point for their other introductory documentation.
Be aware that OpenGL ES is not a simple subject to just jump into. You can easily create an OpenGL ES "Hello World" application by opening Xcode and creating a new project from the OpenGL ES Application template, but you'll have a hard time figuring out what to do after that. However, OpenGL ES is something you can learn independently of Cocoa and Objective-C, so if you want to jump into that topic, I taught a class on the subject which can be found on iTunes U as part of my advanced iOS development course. I walk through the fundamentals of OpenGL ES 1.1 there (2.0 can be found in the fall semester of the course). I also highly recommend Philip Rideout's iPhone 3D Programming book and Jeff LaMarche's series on the topic.
Don't let the initial complexity of OpenGL ES scare you away. You should be able to pick up the basics reasonably quickly if you apply yourself.

Related

Flash Programming(Adobe Air) Vs Objective C?

This isnt a Programming quest but i couldn't think of a better place to ask this question..
I recently started Developing Apps for iPhone using Objective C and Apple xcode environment.now i am quite comfortable with Objective c and iPhone SDK. But now my Company has decided to stop using XCode Environment to build apps but use Adobe Air(Flash Programming) to build apps instead and i have been asked to start Studying Flash Programming and using Adobe Air.. since i couldn't find much information regarding developers or apps build with Adobe Air anywhere i had few questions in mind which i thought someone might be able to answer here
Yes Flash will have the best animations i guess but isnt iPhone's Core Animation Framework ,use of Open GL or use of Game Engine's like Cocos2d available for iPhone good enouf if compared with Adobe Flash??
The Utility Apps can be better build with Apple's own Development Environment even if entertainment apps that dont require much development task might be a bit easy with Flash
Apple Development Environment Xcode and iPhone Sdk must have tons of better api's and features then adobe air could offer??
I have no idea how actually Flash Programming is done.. so after getting comfortable with Objective C is it really worthwhile to just let it go and start studying Flash??
IT would be really great if someone can help me with which will be the right process to develop apps for iPhone Objective C or Adobe Flash ??
The advantage of flash, as sosborn said, is that you will be able to easily port the project to Android, iPhone, and other platforms. You guessed correctly when you said that apple's environment will be able to function with less issues. By going from flash to iphone, you may have some conversion issues to fix.
If the company wants to develop for multiple platforms, then that change is totally valid and smart. If the only reason is ease of development from a graphics standpoint, ask them to look into cocos2d. If they really must use flash graphics, they can be pretty easily set up for use with coco.

How do I start developing applications for iPhone

Hi
I would like to learn and develop applications for iPhone. Can some one guide me on where to start? I'm new to mobile application development. I have good exp in developing web applications and desktop client applications.
Do you have any experience with C? If not, you should probably start there, then work into learning objective-C, and finally dive into the Apple frameworks (i.e. Cocoa touch).
apple has good documentation at http://developer.apple.com
If you prefer books, I would highly recommend iPhone Programming by Aaron Hilligrass:
Also note that you are free to write iPhone apps and test them on a simulator, but to actually push code to a real device you need to purchase a developer profile for $99
Get a mac. An intel based mac is
required. Basically you need Mac OS
X.
Learn C, Objective-C.
Get the iPhone SDK.
Get a good book on it. Do the examples.
Check out the Stanford Learning Series on iTunes, where you can virtually take the course at Stanford. Do the homework assignments, etc...
As darren has said you'll want a good knowledge of C. You can go along the C#/ objective C route but theres also the Airplay SDK. If you have a good knowledge of C apprently you can make games for iPhone quite easily, not had the chance to try it out yet but looks promising. According to the site COD: Nazi Zombies was made using it, might be worth a look.
http://www.airplaysdk.com/

Iphone Developer Program

Well im on the edge about paying $99 dollars to join the Iphone Developer Program, I have the sdk, but im wondering if the program comes with programming lessons or tutorials,
If it doesnt do any of you know where i can learn to make game with opengl es for the iphone/ipod touch??
So my main question is where can i get some good tutorials on programming games/apps for the iphone and ipod touch, and does the Iphone Developer Program come with good lessons on how to program?
Thank You
-techy
Paying the $99 does not give you any additional content or lessons. You already have access to the Apple-supplied sample code. The SDK only provides the ability to test your application on actual hardware, and it allows you to submit applications to the App Store.
The best place to go for beginning tutorials is the Stanford CS193P course which is available online through iTunesU. I would download all this content soon, as it is not guaranteed to be available when the next term starts.
Other than that, I would Google the exact terms that you had in your question: "Open GL ES" "iPhone" "cocoa touch tutorial" There's a ton of content available.
To the resources available with iPhone Dev Package: Yes, there are many resources availible to you as a developer.
http://developer.apple.com/iphone/
There are so many developer tutorials on the net, I think that stanford even released the lessons as videos for free in itunes.
Of course, it depends why you are getting into it. Apple just released facts that there are 100,000 developers, with >60,000 apps in the store. If you are doing it for fun, or to learn something new, then great. If you want to get rich creating fart apps, your time has passed.
There is lots of book available for iPhone development program.

Does it make sense to first learn Cocoa for Leopard and then Cocoa Touch for iPhone?

Actually I don't care too much about Mac OS X development. I want to do only iPod Touch and iPhone development. But anyways, I started learning Cocoa and Objective-C. But it seems like there are many differences between Cocoa and Cocoa Touch, so I am wondering if I am actually wasting my time. Should I just jump directly into iPhone topics?
There is lots of overlap, but if your purpose in learning is to do iPhone programming, then by all means learn iPhone programming directly.
As a side-effect, you will be able to pick up Mac application programming more easily if you should ever have such a desire.
I think you could go either Cocoa-Cocoa Touch or Cocoa Touch-Cocoa and still have a good grasp on what it takes to program for either platform. I tried Cocoa development on my Mac a few years ago and was pretty confused. I finally decided to take up iPhone programming, and picked up Beginning iPhone Development: Exploring the iPhone SDK, worked through that book over a few weeks, and I understand things much, much better now. Really, all it takes is a good explanation of Mac programming. I'm fairly confident I could pick up regular Cocoa programming with far less effort now. Had I started with regular Cocoa programming, I'm fairly confident I would have been able to pick up iPhone programming fairly easily. There are differences, but there are a lot of (very cool) similarities between the two platforms.
PS, I highly, highly recommend that book if you're really interested in iPhone development. It was worth every penny.
Normally I would agree with the other answers here: directly learn the topic you're interested in. But in the case of Cocoa/Cocoa Touch, you'd be better off reading Cocoa Programming for Mac OS X, 3rd ed. by Aaron Hillegass. It's just that damn good!
There are similarities but if the goal is iPhone development, you'll be much better off starting to learn on that platform and then stepping up to the Mac. There's a lot more going on both in the UI frameworks, and in terms of what IB can do so you may well get used to some aspect of the system that is not present on the iPhone (or done differently).
The NS foundation classes are much the same but even there are differences.
Also beware that the simulator will compile and run Mac code that will not compile or run on the phone itself, when using the docs always keep them focused on the iPhone SDK section.
One difference between Cocoa Touch and Cocoa is in the area of memory management.
If you happen to be learning Objective-C for the very first time (or possibly any C-based language for the very first time) I would start with Cocoa Touch.
My reasoning is that the iPhone does not support automatic garbage collection, and you may find it easier to learn the (more difficult? certainly less automatic) way first, then as you migrate to OS X development appreciate the shortcuts that the OS X platform gives you.
If you learn Cocoa development on Leopard initially, you may be frustrated at the seemingly more primitive memory management available in the iPhone.
The two are very similar, though.
Bottom line is if you want to learn to program for the iPhone, go ahead and jump to the iPhone. Mac OS X development is not a prerequisite, just a very similar skillset.
I've taught Mac developers and iPhone developers, and my experience is that it's generally best to learn Mac first, particularly because you can get a solid grounding in Cocoa using Cocoa Programming for Mac OS X, which is still the best book on learning the Cocoa patterns around. So far I haven't found a good iPhone book that teaches the key issues you need to know, and that differentiate Cocoa/Touch programming from Java, .NET and other systems. I've written a couple of articles recently that may be helpful as you think about this:
iPhone Course Syllabus
Review of iPhone Developer’s Cookbook
I've went through about the same question as you, though my initial focus was more on Mac development, the iPhone came later. I'm by no means an expert cocoa coder yet, but things are improving rapidly. I find that the things I learned about cocoa on the Mac come in quite handy on the iPhone; picking up iPhone development certainly went a lot quicker than my first steps in cocoa on the Mac...
In practice, I find both skills come in handy. I'm making an iPhone game, but the data set it uses (the actual puzzles) are created using a small cocoa app I've developed for the Mac. Is there a specific reason why you don't want to learn Mac development? You don't need additional development/designing tools for your game?
(screenshot of the mac app: http://www.qixis.com/images/edit16-screenshot.png)

Is it better to start how to code in Objective-C for the desktop before you venture to the iPhone?

I have C/C++ experience so learning Objective-C is not completely foreign to me. However, I noticed that writing an application for the iPhone is not as simple as for the desktop platform. Should I start to get some solid experience on the desktop before I jump into the iPhone? I am not a commercial developer, and merely doing this as a hobby and for learning purposes. What is your recommendation?
For what it's worth, a comment from another newcomer to iPhone development...
My background - I was a C Programmer about 15 years ago and since then I've moved around technologies quite a bit - I'm now an Adobe Flex developer in my day job. By night, however, I'm trying to transform myself into an iPhone developer ;-)
So I bought a book on iPhone SDK development - 'iPhone in Action'. I also bought 'Programming in Objective-C 2.0'. I thought I'd be set with these two but after a couple of days reading and working through exercises it was clear that... I was hopelessly lost!
So I bought another book - this time, 'iPhone SDK Development' from the Pragmatic Bookstore - this is a work in progress book but looked 'right' for me. Turns out this book took me further - it's a great piece of work - however, the early chapters were paced nicely and I was able to follow along and then all of a sudden they began to assume I could recall perfectly the lessons learnt and the procedures followed in earlier chapters and I began yet again to flounder a little - the worst thing I find when trying to learn something from a book is to have to jump around from place to place constantly to make any sense of what I'm meant to be doing.
So (yeah, I know... but bear with me...) I bought ANOTHER book... 'Beginning iPhone Development' from APress. Now THIS book assumes nothing. For a beginner to iPhone development, THIS book hits the target. No jumping around necessary and finally I found I was progressing.
However, what I'm finding is that ALL three books in CONJUNCTION with one another really seem to provide me with a more complete picture - collectively I have a great set of tutorial and reference material. The Objective-C book I've not touched on so much yet but I expect that to be what I need it to be - a reference manual for the language; I'll not need that until I'm much deeper in to the guts. I'm slowly emerging from that horrible "in at the deep end and I can't swim very well" feeling to one where I can at least tread water. Hopefully with a bit more paddling I'll be able to touch the bottom - certainly my confidence is returning ;-)
So anyway, to address the original question - personally if I did this all over again, I don't think I would have gained anything by starting out building for the Mac first and then to the iPhone. I would definitely have lost less hair had I bought the APress book first - that for me was the book that made complete sense of everything for me. I think then the 'iPhone SDK Development' Pragmatic book was the best backup/followup book. This is the path I've suggested to a colleague and I'm confident it's a good one.
Hope this helps!
Jamie.
It is definitely helpful to have some Cocoa experience before going into iPhone development, but I personally wouldn't sweat it that much. Learning how to use the Cocoa framework and getting comfortable with it in general would be beneficial, but there are certain aspects of desktop Cocoa programming that you will find have little relevance to iPhone programming (e.g. user interface design with Interface Builder). Also, there are unique aspects of iPhone programming that normal Cocoa programming won't really prepare you for. (Some experienced Cocoa devs still had somewhat of a learning curve when they first got into iPhone development.)
In other words, I would recommend learning the fundamentals of normal Cocoa development, but you won't need to become a Cocoa guru in order to learn how to develop iPhone apps.
If your only intend in coding desktop apps is to get familiar with Objective-C, cocoa and Xcode, it is not worth.
You will learn nothing starting with desktop apps that you would not learn getting straight in iPhone apps. Desktop apps are not simpler than iPhone apps, they are just different.
It may even be counter productive if you learn specificities of desktop apps that you will have to 'unlearn' on iPhone development.
Of course, if your intend is to get into the OS X ecosystem, learning both would be very valuable.
In some ways the iPhone is simpler for a C/C++ developer. No garbage collection is the big one. If you start on the desktop and get used to GC, you'll have a hell of a time when you hit the iPhone.
There is no need to or benefit in learning desktop Cocoa before moving to UiKit on the iPhone. There may be some disadvantages.
Although there are a lot of concepts shared between UIkit and Cocoa they are no easier to learn on the desktop. And at the end of the day, they are not identical. Similarly there are a lot of frameworks that are shared between iPhone and the desktop - in these cases, there is nothing to be gained from using the desktop versions before their equivalents on the phone.
There some difficulties that you will face only on the iPhone and things that might make things easier on the desktop:
you develop on the target machine, on iPhone, target management is more difficult
iPhone is memory and processor contstrained
there is no Garbage collection on iPhone
My view is that it is a good idea to get used to these issues as soon as possible rather than getting into "bad habits" on the desktop (or just generating misunderstanding when you go to iPhone).
If you have any development experience you know that all languages are alike, and you only know if you fully grok it only by working with it.
My approach to learning a new development environment is to pick a problem you want to solve (and since the phone is in your pocket all the time, you're likely to have some idea), and bang your head on it.
There's a ton of apple sample code, answers here and on other sites. Start with a working sample app that is not too far from what you want to do, and tweak it over time. You are gratified by a working app, find out about problems right away, and can learn small bits at a time.
The biggest challenge is not learning Cocoa and/or Cocoa Touch but Objective-C. Once you have the fundamentals Cocoa is simple and similar to many other OO frameworks.
I suggest:
The Wikipedia article on Objective-C: https://en.wikipedia.org/wiki/Objective-C
"External links" at Wikipedia for some fundamentals of the language
Hot Cocoa podcast: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=294050835
Cocoa Cast podcast: http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=298413458
Then the Stanford iPhone Application Programming course on iTunes U: https://podcasts.apple.com/us/podcast/iphone-application-programming-spring-2009/id384233222
Join the developer program at Apple: https://developer.apple.com