Playing 3D Animation in iPhone App (Possibly using a looping video) - iphone

Is there a relatively easy was to include a 3D animation into an iPhone app? We have the animations already made up for another project and our client has asked if they can be placed inside an iPhone app. We could perhaps include a low-res looping video of the animation (it's just a 3D component rotating on a single axis), or would it be better to look into getting the 3D animation directly onto a view?
Cheers,
Dan

You could either split it up into a set of frames and use the UIView animationImages property like so:
http://appsamuck.com/day2.html
Or assuming its already an OpenGL animation you could port the code to openGLES.
Here are good tutorials for openGL ES:
http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html

Related

Converting UIImage animation to use Cocos2d sprite animation

I have an app that uses UIImage animation, and the timing of the animation is inconsistent. I would like to convert over to using sprite animation with cocos2d.
Can I add this functionality to my existing project? Are there any good tutorials on how to add Cocos2d to an existing project?
I've seen people just use Cocos2D inside an EAGLView with good results. This fellow seems to have got it working. Having said that, I would probably try to optimize your UIImage animation. Using PNGs is generally faster, and try to scale your animation image frames to the exact display size. And, make sure your animation frame rate isn't above 30 or so.

iOS - rotating a sphere and responding to touch

I've been tasked with creating a sphere that can be rotated by touch (or animated) along one axis, like a regular globe. I should also be able to draw animated lines on this sphere (eg. draw a line between Sydney and New York). I usually do all my animations in 2D, typically using core animation as I've never really had a need to do anything else. I have a feeling that this sort of problem though requires me to jump into OpenGL.
My question is whether it would be possible to achieve this using core animation (time is of the essence), or if I do need to quickly learn OpenGL. If so, is this a fairly simple problem to solve? I'm a pretty good programmer, but I have no OpenGL experience. Would a capable programmer be able to do this in say 2 weeks?
As a further question, supposing I do use OpenGL, if I then need to do other things in the project (eg. show different screens, or show screens over the top of the sphere), am I able to use UIKit or does the entire project need to be in OpenGL?
Core Animation is for animating views, and basically a 2D animation layer - so it's a no-go for the 3D rotating sphere.
Drawing a textured sphere is rather easy, see this sample
Mixing GL and regular UIView's is not a problem. You can overlay regular controls over the GL view.

cocos2d game sample based on gameloop?

I want to develop 2d game through Cocos2d.but i could not find
any tutorial based on the following.I want one game loop and one draw screen.can I do Multiple sprite animations within one scene..(translating World etc).where can i find tutorial how to use those classes which are coccos2d?
-(void)gameloop
{
calculation();
drawImage();
drawImage1();
}
It is quite simple, you do not have to know opengl essentials to use cocos2d. cocos2d is quite simple yet awesome!. Just download the cocos2d 0.99.5 and it comes with sample tests. You will be able to find almost all of the things you want to do in a game i.e. animations, touches, moving sprites, particle system etc etc
so just go to:
http://www.cocos2d-iphone.org/
How to learn OpenGL by example, say, building a rotating globe?

2D Game Character Animation in iPhone - How is it done?

What I mean is, do animators work on an animation in say Flash (or some other kind
of key frame animation program) and then export it to the iphone somehow?
For example, say I am an animator and I want to create a person waving for an iphone
game. What type of external program would I use and then what libraries on the iphone
sdk would I use to load them in?
I think it all depends on how in depth you want to get. Making a 2D game is a broad statement. For example, to make what you ask. You would just make a series of PNG images for a cell based animation of the wave. wave1.png, wave2.png, waveN.png...
Then load the PNG images in and then play them in sequence. You can do this with UIImageView, Core Animations classes, or manually your self with UIImages and UIViews.
There a lot of great game engines you can check out too. Here is a link for an example of what is available. Game Engines
For the best performance, most companies/developers use OpenGL to do both 2D and 3D style games. You can utilize a lot of tricks for the textures used in your games.
The iPhone natively supports key frame animation with the CAKeyframeAnimation class.
I think the most popular framework for 2D games is Cocos2D: http://cocos2d.org/

OpenGL ES iPhone Textures

For one of my new games I'm using OpenGL ES since it has multiple enemies and bullets, etc. How do you draw images on the screen with Opengl ES? I have a player.png image that is a 48x48 pixel image; how would I draw that on the screen?
The basic answer is that you create a quad out of two triangles and draw that "camera facing" or in 2D mode on the screen.
In the iPhone example of OpenGL ES (the rocket ship one) you can see the Texture2D class which handles loading png's and displaying them. It's simple, but works.
But I would suggest you take a look at cocos2d iPhone. This framework handles a lot of this stuff for you and lets you focus a lot more on your game: http://code.google.com/p/cocos2d-iphone/
You might also look at GameSalad for a non-programmery way of making simple iPhone games: http://gamesalad.com/