views:

69

answers:

2

In case this is possible, it would be nice to see some examples!

Thanks, rui

+1  A: 

Yes, it's possible, after all OpenGL ES context is inside just another UIView subclass. Thing is that Apple doesn't recommend mixing Cocoa Touch objects and OpenGL ES views due to huge performance degradation.

Rudi
+4  A: 

This question asks something very similar, and as I state there it's trivial to have OpenGL ES content coexist with UIKit controls. The OpenGL ES content lives within a CAEAGLLayer that backs a UIView, which is part of the normal view hierarchy. You can easily overlay other UIViews on top of it.

For an example of this, you can look at the source code to my Molecules application, where I place two UIButtons on top of my OpenGL ES view.

In my benchmarks, you lose ~1-5% of your OpenGL framerate by placing other views on top of the OpenGL ES view, which is not too terrible. What you don't want to do is make your OpenGL ES context non-opaque and try to overlay that on top of other view elements, because you'll see a significant drop in rendering speed then.

Brad Larson