Ben Williams
Ben Williams

Reputation: 4695

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?

Upvotes: 4

Views: 3717

Answers (1)

reflog
reflog

Reputation: 7645

  1. Core Animation is for animating views, and basically a 2D animation layer - so it's a no-go for the 3D rotating sphere.
  2. Drawing a textured sphere is rather easy, see this sample
  3. Mixing GL and regular UIView's is not a problem. You can overlay regular controls over the GL view.

Upvotes: 1

Related Questions