Search code examples
iphoneopengl-escore-animationtransformcalayer

Wrapping/warping a CALayer/UIView (or OpenGL) in 3D (iPhone)


I've got a UIView (and thus a CALayer) which I'm trying to warp or bend slightly in 3D space. That is, imagine my UIView is a flat label which I want to partially wrap around a beer bottle (not 360 degrees around, just on one "side").

I figured this would be possible by applying a transform to the view's layer, but as far as I can tell, this transform is limited to rotation, scale and translation of the layer uniformly. I could be wrong here, as my linear algebra is foggy at this point, to say the least.

How can I achieve this?


Solution

  • Take a look at the Apple's sample code PVRTextureLoader This is an OpenGL project that demonstrates how to display a texture (your label) on a surface (on a cylinder in your case).

    Jeff LaMarche has posted a nice tutorial to get started with Open GL.