[iPhone Dev] 2D Games, OpenGL or Quartz? - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: [iPhone Dev] 2D Games, OpenGL or Quartz? (/thread-2602.html)
Pages: 1 2
[iPhone Dev] 2D Games, OpenGL or Quartz? - jAuriya - Jun 5, 2008 07:08 AM
At first, I'm truly sorry if this is the wrong area to ask this, I couldn't find anywhere else where to post it.
I have recently started building interest for the iPhone/iPod Touch development and have made a concept of a game which I want to work out.
My past experiences with programming is a bit of C and a lot of C++. And as for graphics libraries, I know SDL very well and very little bit of OpenGL usage, but not much in that area since it seemed way more work than SDL at that time. ;p
I've been a 2D programmer since the start, am not really interested in 3D for some reason.
Just to try it out I have looked at a downloadable source from Apple, a OpenGL using game called "CrashLanding", and that sort of made little sense. But so did SDL when I just started it so I really want to get into this area of development.
Now I know the iPhone gives two options for graphics (I'm gonna exclude CoreAnimation); Quartz and OpenGL ES.
So my question really is, what would be best to go with when developing 2D games for the iPhone/iPod Touch platform?
(Also as a side question, does anyone know any good tutorials to start with when going into iPhone/Touch development? I know the docs and sources are a very good place to start, but sometimes non-professionals have more useful comments and explanations. No offense to anyone though. )
[iPhone Dev] 2D Games, OpenGL or Quartz? - Skorche - Jun 5, 2008 08:18 AM
Quartz may be somewhat GPU powered, but it's almost certainly going to be CPU intensive compared to using OpenGL. A CPU intensive iPhone app means that you will drain the battery quickly, and probably not run smoothly as it's not a fast processor.
Considering that GL and Quartz have similar learning curves, you might as well just go with GL.
[iPhone Dev] 2D Games, OpenGL or Quartz? - jAuriya - Jun 5, 2008 08:53 AM
Thank you for the quick reply!
That has set things a bit more straight for me, at least now I know what to learn!
I had another question though, even though OpenGL ES is kind of a stripped down version of OpenGL; will learning OpenGL for desktop usage be the same as on the iPhone/Touch? Or will I specifically need to learn things about OpenGL ES?
There are good NeHe tutorials in OpenGL but am not sure if I can apply the things they teach to the iPhone/Touch
[iPhone Dev] 2D Games, OpenGL or Quartz? - Cochrane - Jun 5, 2008 09:11 AM
I'd say it's best to first learn OpenGL ES and then "real" OpenGL (although I don't know anyone who actually did so). You can use all OpenGL ES knowledge on the desktop, but the other way round there's a good chance you'll get used to things like immediate mode, display lists and similar, which don't work in OpenGL ES (and aren't a good idea on the desktop either, as far as I know).
[iPhone Dev] 2D Games, OpenGL or Quartz? - Fenris - Jun 5, 2008 09:13 AM
What Cochrane said: getting into OpenGL on the ES end will most probably make you a better graphics programmer than either vanilla GL and Quartz.
[iPhone Dev] 2D Games, OpenGL or Quartz? - jAuriya - Jun 5, 2008 10:23 AM
Whoa nice resources and help here, thank you all! ^^
I'll be going for OpenGL ES then, except I'm wondering where I may be able to find good tutorials about them? I've googled around a bit but can't find anything useful, found one thing that was about a pocketpc2003 but that looked nothing like or at least very different from what I saw in the source files of the iPhone games.
Or would I need to purchase books? (Poor student here, I hate money! )
Anyway thanks for the answers, greatly appreciated!
[iPhone Dev] 2D Games, OpenGL or Quartz? - AnotherJake - Jun 5, 2008 11:46 AM
I have to say I agree that starting with OpenGL ES is probably better than desktop GL. I like it for its simplicity, and it still has great features and power and most of what you do with ES will translate directly to desktop (there are some special features depending on the platform though). I can't think of any tutorials on it right now, but I'm sure you'll see a lot more in the months ahead.
But... I must say that I think skipping CoreAnimation on iPhone is not wise IMHO. For iPhone development I forced myself to learn some CA so that I could better fit in with the UI look and feel of the iPhone, and I have to say I really, really like it a lot! It was a huge surprise to me just how easy and smooth it is to use -- far easier than picking up OpenGL. Right now I'm using a liberal combination of OpenGL for 3D stuff and CoreAnimation for 2D (and UI) stuff on the iPhone. From what I've used of it so far, I think could be a perfect solution for 2D games on the iPhone. I wouldn't dare say much more about it until it's out of beta, other than to suggest others give CA a fair chance for 2D animation before jumping all the way to OpenGL on iPhone.
[iPhone Dev] 2D Games, OpenGL or Quartz? - AnotherJake - Jun 5, 2008 11:58 AM
After thinking about this for a few moments, I think I can say this one technical aspect of CoreAnimation without violating NDA, which might not be so obvious to some:
With OpenGL you will typically (depending on your implementation) set up a single timer to render a scene repeatedly, without stopping. That takes more processing power than only rendering when needed. CoreAnimation's timers start and stop as needed, so that if you have a static scene with nothing moving, it won't waste battery. This isn't quite as important to consider with traditional desktop systems, a little more so with laptops I suppose, but with mobile devices such as iPhone it can become critical. Now, this is not to say that you can't do the same thing with OpenGL, but you will have to put in the extra effort to implement it yourself, whereas with CoreAnimation it's automatically there for you behind the scenes.
[iPhone Dev] 2D Games, OpenGL or Quartz? - bronxbomber92 - Jun 5, 2008 12:58 PM
For some tutorials, check out http://iphonedevcentral.org/ (am I allowed to post this?)
[iPhone Dev] 2D Games, OpenGL or Quartz? - jAuriya - Jun 5, 2008 01:08 PM
bronxbomber92 Wrote:For some tutorials, check out http://iphonedevcentral.org/ (am I allowed to post this?)
Hey thanks for this!
I'll look into it now. ^^
AnotherJake Wrote:With OpenGL you will typically (depending on your implementation) set up a single timer to render a scene repeatedly, without stopping. That takes more processing power than only rendering when needed. CoreAnimation's timers start and stop as needed, so that if you have a static scene with nothing moving, it won't waste battery.
That's exactly what I'm looking for!
With SDL I had a pretty easy programming way;
<Main Game Loop>
<Check For Events & Inputs>
<IfEvents -> DoGameHandling>
<Check FPS, update Timer(s) and update Screen>
</Main Game Loop>
So when there are no events going on, it does nothing but handle the FPS, Timers and updating the screen.
This is the best way I have experienced games on laptops (using a Macbook right now), least CPU usage and so longer battery life while gaming. I believe this would also apply for the iPhone.
So I could use CoreAnimation for 2D image rendering as well then?
Sorry if I sound a bit too, -- not knowing, I'd rather have it right than be confused or do things over many times.
Thank you all very much for the help so far!
[iPhone Dev] 2D Games, OpenGL or Quartz? - AnotherJake - Jun 5, 2008 01:14 PM
@ bronxbomber92: Never heard of them, but:
"Experience developing on the MAC applications"
... I dunno, those guys don't appear to be "Mac" developers, and they apparently do not speak English as a first language (at least not very well).
bronxbomber92 Wrote:(am I allowed to post this?)
Probably not an issue as long as *you* are not divulging technical details of iPhone which have not already been made public by Apple. That said, it is obviously better not to say anything at all if in doubt. Besides, this whole NDA mess should be over with in a few weeks -- we assume.
[iPhone Dev] 2D Games, OpenGL or Quartz? - AnotherJake - Jun 5, 2008 01:23 PM
jAuriya Wrote:So I could use CoreAnimation for 2D image rendering as well then?
Oh yes, absolutely. I believe CoreAnimation on iPhone is very easy to learn compared to OpenGL, or even Quartz for that matter. You will have to carefully read the documentation (and be patient) for now since there aren't any "legal" tutorials available yet, but if you have some programming experience it shouldn't be impossible to learn how to do it with the resources Apple provides to iPhone developers. I can't say what or where to look, but it's all there. The learning curve with CoreAnimation can be measured in hours (assuming you know Obj-C and general Cocoa), rather than weeks with OpenGL (which will still require some Obj-C knowledge on iPhone to get going). It will be best to have some prior knowledge of Cocoa programming. Pretty much you will need to know that for iPhone development anyway. The only alternative to learning the iPhone OS environment would be Unity I believe, but I don't know the details of their iPhone program.
[iPhone Dev] 2D Games, OpenGL or Quartz? - arekkusu - Jun 5, 2008 05:29 PM
AnotherJake Wrote:...since there aren't any "legal" tutorials available yet
Sure there are.
Download the Free iPhone SDK and start reading the documentation and sample code.
Or just read the Core Animation documentation from the desktop.
[iPhone Dev] 2D Games, OpenGL or Quartz? - AnotherJake - Jun 5, 2008 05:58 PM
[iPhone Dev] 2D Games, OpenGL or Quartz? - jAuriya - Jun 6, 2008 02:45 PM
Thats so great! This topic has helped me a lot!
Awesomely iThanks to everyone here! ^^ Thanks for all the information!
I hope to also help out someday when I progress far enough!