In depth graphics for mobile development - iphone

I am a long time developer with alot of experience in the mobile field.
I feel now that the field I am lacking in is the understanding of the UI internals and performance, maybe more in the traditional computer graphics field.
I am looking for recommended sources for adding understanding in these areas, hopefully without reading through entire bibliography on OpenGL etc.
Is this possible and what are some recommended sources?

Check http://www.RayWenderlich.com there are a ton of graphics related tutorials there form 2D to 3D including CoreGraphics and OpenGL.
Also the Apple documentation has some good information on graphics performance. You really should just dive in then post specific questions here.

Related

Writing a "Brushes" quality drawing app, need book and resource recommendations

I've spent about a week reading all the freely available information on iPhone drawing, animation, and OpenGL. Using the available iOS drawing examples like Apple's GLPaint and Quartz sample apps I've written a few versions of a painting tool, but I've hit many limitations which I think is due to "not knowing what I don't know." Quartz is easy to use and fast initially, but slows to a crawl after 20 or 30 paths due to having to rerender the context with every addition. OpenGL stroke rendering seems slow in general (GLPaint app) and makes the UI touches lag and feel "cheap". A search through Amazon and the forums has not revealed any great book or resource recommendations on low level iPhone drawing technologies that could help me become technically proficient enough to write a high performance app with a user experience and visual quality as good as "Brushes" or "Adobe Ideas 1.0". I'm not trying to get free code, I want to learn and I'm willing to pay for learning tools!
Suggestions? Guidance?
Edit: I'm surprised at how few books are out there. I'm making progress, drawing paths that are responsive even when there's many of them and planning an easy undo feature, but still wondering about how to have an erase feature and undo at the same time. Erase will require the scene to be rasterized I suppose, and then undo would have to be done by cacheing screenshots instead of just keeping track of paths.
Look into CGLayers. This will allow you to cache some of your drawing and not be forced to re-render everything each time it changes, but rather only draw the changes. You'll need to do a little work if you want to add undo/redo support, but this should alleviate some of your performance issues.

OpenGL ES and real world development

I'm trying to learn OpenGL ES quickly (I know, I know, but these are the pressures that have been thrusted upon me) and I have been read around a fair bit, which lots of success at rendering basic models, some basic lighting and 'some' texturing success too.
But this is CONSTANTLY the point at which all OpenGL ES tutorials end, they never say more of what a real life app may need. So I have a few questions that Im hoping arent too difficult.
How do people get 3d models from their favorite 3d modeling tool into the iPhone/iPad application? I have seen a couple of blog posts where people have written some python scripts for tools like Blender which create .h files that you can use, is this what people seem to do everytime? Or do the "big" tooling suites (3DS, Maya, etc...) have exporting features?
Say I have my model in a nice .h file, all the vertexes, texture points, etc.. are lined up, how to I make my model (say of a basic person) walk? Or to be more general, how do you animate "part" of a model (legs only, turn head, etc...)? Do they need to be a massive mash-up of many different tiny models, or can you pre-bake animations these days "into" models (somehow)
Truely great 3D games for the iPhone are (im sure) unbelievably complex, but how do people (game dev firms) seem to manage that designer/developer workflow? Surely not all the animations, textures, etc... are done programatically.
I hope these are not stupid questions, and in actual fact, my app that Im trying to investigate how to make is really quite simple, just a basic 3D model that I want to be able to pan/tilt around using touch. Has anyone ever done/seen anything like this that I might be able to read up on?
Thanks for any help you can give, I appreciate all types of response big or small :)
Cheers,
Mark
Trying to explain why the answer to this question always will be vague.
OpenGLES is very low level. Its all about pushing triangles to the screen and filling pixels and nothing else basicly.
What you need to create a game is, as you've realised, a lot of code for managing assets, loading objects and worlds, managing animations, textures, sound, maybe network, physics, etc.
These parts is the "game engine".
Development firms have their own preferences. Some buy their game engine, other like to develop their own. Most use some combination of bought tech, open source and inhouse built tech and tools. There are many engines on the market, and everyone have their own opinion on which is best...
Workflow and tools used vary a lot from large firms with strict roles and big budgets to small indie teams of a couple of guys and gals that do whatever is needed to get the game done :-)
For the hobbyist, and indie dev, there are several cheap and open source engines you can use of different maturity, and amount of documentation/support. Same there, you have to look around until you find one you like.
on top of the game engine, you write your game code that uses the game engine (and any other libraries you might need) to create whatever game it is you want to make.
something many people are surprised with when starting OpenGL development is that there's no such thing as a "OpenGL file format" for models, let alone animated ones. (DirectX for example comes with a .x file format supported right away). This is because OpenGL acts somewhat at a lower level. Of course, as tm1rbrt mentioned, there are plenty of libraries available. You can easily create your own file format though if you only need geometry. Things get more complex when you want to take also animation and shading into account. Take a look at Collada for that sort of things.
again, animation can be done in several ways. Characters are often animated with skeletal animation. Have a look at the cal3d library as a starting point for this.
you definitely want to spend some time creating a good pipeline for your content creation. Artist must have a set of tools to create their models and animations and to test them in the game engine. Artist must also be instructed about the limits of the engine, both in terms of polygons and of shading. Sometimes complex custom editors are coded to create levels, worlds, etc. in a way compatible with your specific needs.
Write or use a model loading library. Or use an existing graphics library; this will have routines to load models/textures already.
Animating models is done with bones in the 3d model editor. Graphics library will take care of moving the vertices etc for you.
No, artists create art and programmers create engines.
This is a link to my favourite graphics engine.
Hope that helps

Help me start out with OpenGL

Till today I am working with Basic UIKIT application but now onwards I need to work in OpenGL.
Problem is I have not any idea about OpenGL and am confused lot about how to start and from where to start.
I need to create an application which is same as "iBeer" (see movie in YouTube).
So I am having lots of confusion about how do I create graphics of beer that you seen in application, so what should be preferred library?
Creating opengl applications is kinda time consuming, it takes time to learn the syntax and get comfortable with.It's not easy to just magically write an "ibeer"-app, even if it's not the most advanced application ever written.
I don't think there are any shortcuts, you will have to learn opengl and its syntax.
iphone also uses Opengl|Es which syntax is not to far away from regular opengl, but still differs enough that you can't use regular opengl-engines.
The two best opengl resources i have encountered are:
The Red Book
Nehe's game tutorials
There are also some good tutorials specifically for opengl|es and iphone development
Nehe tutorials ported to iphone
Blog-post about iphone-development
However i'm gonna guess that you are more interested in creating the application than learning opengl syntax, therefore you should also take a look at some opengl-engines
Irrlicht opengl engine
Unity
There are probably a million more resources on the web, should get you started though.
Jeff LaMarsh has a good primer on his blog. Here's the TOC:
Basic Concepts. A Look at Simple
Drawing Viewports in Perspective
Let There Be Light.
Living in a Material World
Textures and Texture Mapping
Learning OpenGL and/or OpenGL ES is done best by learning the prerequisite concept of Computer Graphics in general, as well as learning the mathematics involved. Specifically linear algebra, vector spaces and how matrices can be used to represent coordination systems. OpenGL is just an API which is easy to use, as long as you understand what you're doing. If you're afraid of math, don't waste your time.
For absolute beginners, I recommend the book "3D Math Primer", with errata and samples on gamemath.com and an online article named "The matrix and quaternion FAQ" available here: www.j3d.org/matrix_faq/matrfaq_latest.html
And the OpenGL ES 1.x specification for implementation used on the iPhone:
http://www.khronos.org/opengles/1_X
And last but not the least, the specification for OpenGL 2.1 and the first version of the OpenGL Shading Language, GLSL:
http://www.opengl.org/registry/doc/glspec21.20061201.pdf
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.10.59.pdf
A lot of people I've spoken to don't think the specification counts as documentation for library users, but in my opinion it does; simply because it is accurate, it has has authority and any other publications would be just citing it anyway.
If you understand the mathematics required and the general concepts of Computer Graphics, reading the standard should be a breeze.
Last word: Avoid NeHe at all costs. I saw it suggested here, and it's probably okay if you want to go the try-and-fail route. NeHe's tutorials teaches how, but not why. Most of the examples are also horribly outdated.
I recommend focusing on the programmable pipline of OpenGL (shaders) instead of the fixed-function pipeline, if you want to use OpenGL on a computer. (OpenGL ES 1.x does not have shaders) Shader languages like Cg, GLSL and HLSL are here to stay. The proof for that is the latest OpenGL 3.1 standard where the only way to get things done is through shaders. Just a wise warning, as The RedBook and other "Tech yourself OpenGL in 10 days" books tend to focus on the latter.
I would suggest taking the other technologies out of the equation and learning OpenGL separately: then look at the differences in ES and introduce the iPhone specifics, etc. I would second Mads that NeHe is a bad place to start: There are some mistakes in those tutorials that have gone unaddressed (such as forgetting that OpenGL's y-coordinate is inverted relative to most UI toolkits but also forgetting that BMPs are stored upside-down relative to UI toolkits, so loading a BMP and displaying it works through coincidence rather than by intention).
The OpenGL red book suggested above is hands down one of the clearest and best written computing books I have ever read, but the free online copy is out of date so grab a modern dead-tree copy. You won't regret it. Again I agree with Mads that a good understanding of the maths is important. I think you could touch up your maths in parallel with reading the red book as it breaks you in gently and has some appendices covering some of the tricks.
Finally when trying out different things, like the impact of translations, scaling, etc., you often find yourself in a compile,tweak,compile loop. Much more effective is to have an app that lets you tweak parameters at run-time: but writing such a thing whilst learning is a bit of a steep ask. Nate Robins has some excellent demonstration programs that let you tweak parameters to opengl calls and show you the impact right there in the app. They come highly recommended by the opengl red book itself : http://www.xmission.com/~nate/opengl.html
I found this book quite useful for learning OpenGL ES 1.1 (the version the iphone supports):
http://www.amazon.co.uk/Mobile-3D-Graphics-Kaufmann-Computer/dp/0123737273/ref=sr_1_3?ie=UTF8&s=books
Although I already knew the basics of OpenGl before reading it, so can't vouch for how good it is for a total beginner.
Other people seem to like the "Redbook", a free online version is available here: http://www.opengl.org/documentation/red_book/ This might be useful for learning the basic principles, but it covers standard desktop openGL, and there are differences between that and what is available on the Iphone.
There are also a couple of examples that come with the Iphone SDK, which I found very useful.

Which technologies/concepts do you suggest I learn before creating an iPhone game?

Sorry if this is a broad question, but other than Objective-C, Cocoa, and OpenGL ES, what technologies or concepts would you suggest I read up on before writing a game for the iPhone? I'm a beginning game developer and need all the help I can get :)
MATHS - I would advise this topic
Some example areas of interest for applications in Game Development
Calculus, Geometry,The Cartesian Co-ordinate System, Vectors, Matrices, Transformations etc...
Sorry, my answer is not computing related.
A game tells a story, a great game tells a great story. So I would suggest to learn principles of storytelling.
Not going as scholar as Aristotle's Poetics, I recommend more modern Story by Robert McKee. It focuses on movie making, but I am pretty sure that many of the concepts he develops can be applied to game making.
You should read some articles on GameDev. Obviously, learning some of the fundamental concepts in computer graphics would be very helpful. But really, once you get to where you can write Objective-C and understand the APIs, go ahead and get started. You will learn a lot in the process; of course, keep learning and reading about these things I mentioned, but start coding. Find some books on game programming, particularly AI and so forth. Go ahead and get your feet wet programming though. Of course, be sure you learn your language thoroughly.
Quite frankly, I have found that I never know what I need to know until I actually get my hands dirty. That's why I suggested here that someone looking to jump into designing a 3-D iPhone game start with some simpler, targeted projects. These targeted projects can teach you core concepts as you put them to practical use. OpenGL seemed like this impossible-to-understand black box until I made myself perform some simple tasks with it. In a few weeks, I had an application based on it.
In college, I would spend weeks trying to understand the theory behind an aspect of thermodynamics, but then I would see one practical application for it and the whole thing would fall into place. Since then, I've focused on finding specific applications for concepts before spending too much time with the pure theory behind them.
A solid understanding of what makes a good gaming UI especially on the iPhone would be key, especially with the options it provides, be it accelerometers, or onscreen touch inputs.
I'd be sure to try out existing games and see what works, what doesn't, and what gets good feedback. You may also want to look at Flash and DS based games to see what works on other small screens/devices.

Beginner guide to OpenGLES on iPhone

Does anyone know a good beginners guide to using OpenGLES on the iPhone? I have found some but they all require assumed knowledge which I don't have.
Simon Maurice has some great tutorials on the very first steps. Take a look: http://www.cocoachina.com/wiki/index.php?title=Category%3aSimon_Maurice_iPhone_OpenGL_ES. Do them from the beginning and you'll have a good sense of the basics.
EDIT:
Backup link
Source code
You need only one reference:
http://www.khronos.org/opengles/sdk/1.1/docs/man/
Yeah, some of the documentation doesn't make a lot of sense the first time you read it, but really, read the sentence/paragraph/page again, and again. It really does make sense, and it's very accurate. Which is something you really can't say from tutorials. Tutorials are almost always written by people that don't seem too fussed about leaving out important details while documentation like that is usually written by very nitpicky people that cram every little important fact into (possibly overly-complex) sentences.
Oh, and one golden tip: Add a search function to your browser that does this:
http://www.google.com/search?q=%s+site%3Awww.khronos.org%2Fopengles%2Fsdk%2F1.1%2Fdocs%2Fman%2F&btnI
(replace %s by whatever your browser's search term replacement string is, the above example is for Opera)
I've bound it to the o prefix, so whenever I need to look something up on OpenGL/ES, I just type o glDrawElements in the address bar and instantly get the documentation page on it.
Once again, if I may plug my own work, I have a short writeup on what I learned while writing Molecules for the iPhone. I came into this having no experience with the 3-D side of OpenGL (I had done a little 2-D hardware acceleration before), so I have a bit of a different perspective on the subject. The source code to Molecules is available, so you might be able to learn something from poking around inside it. I also have written a post on how to use Core Animation structures and functions to accelerate OpenGL ES rendering, if you want something a little more technical.
Bill Dudney has a post here about how he started getting into OpenGL ES, and then a follow-on here where he provides code for a Wavefront OBJ loader for the iPhone.
I believe that I've seen a few more good resources around Stack Overflow in various answers, so you might search around and see what else you can find here.
For OpenGL NeHe is a great tutorial. Though, it doesn't specifically cover OpenGLES, it should still be pretty helpful. Just be prepared to run into things now and again that won't work on the iphone.
Also you can get v1.1 if "The Red Book" online.
Simon Maurice's tutorial can be found here
"The Red Book" is not recommended to OpenGL/OpenGLES beginner. It is book for professionals.
The first step is should try to run downloaded simple programs or simple codes from OpenGL web sites.
Here's a good (non-Chinese) link to Simon Maurice's tutorials:
http://web.me.com/smaurice/iPhone_OpenGL_ES_Blog/iPhone_OpenGL/Archive.html
His tutorials are excellent; they're what I used to learn OpenGL ES.
In addition to "The Red Book", another useful book -with tutorials and reference- is OpenGL SuperBible.
Again not OpenGLES specific, but I believe it is useful to learn OpenGL features in general, then filter out the ones you don't need.