I'm working on a game where I need to let the player look at a plane (e.g., a wall) through a lens (e.g., a magnifying glass). The game is to run on the iPhone, so my choices are Core Animation or OpenGL ES.
My first idea (that I have not yet tried) is to do this using Core Animation.
- Create the wall and objects on it using CALayers.
- Use CALayer's
renderInContext:
method to create an image of the wall as a background layer. - Crop the image to the lens shape, scale it up, then draw it over the background.
- Draw the lens frame and "shiny glass" layer on top of all that.
Notes:
- I am a lot more familiar with Core Animation than OpenGL, so maybe there is a much better way to do this with OpenGL. (Please tell me!)
- If I am using CALayers that are not attached to a view, do I have to manage all animations myself? Or is there a straightforward way to run them manually?
- 3D perspective is not important; I'm just magnifying a flat wall.
- I'm concerned that doing all of the above will be too slow for smooth animation.
Before I commit a lot of code to writing this, my question is do you see any pitfalls in the plan above or can you recommend an easier way to do this?