Here’s a tip you definitely need to give a read if you’re of the common opinion that OpenGL is only appropriate for fullscreen applications like games: how to not only integrate OpenGL views with UIKit nicely, but use multiple OpenGL views!
Things get more complicated when you want to have multiple views with OpenGL rendering. I don’t mean multiple viewports in the same screen, but multiple views in the sense of multiple UIViews. My current project, for example, has different views connected with a UITabBarController. Some of the are custom UIViews and some of them are OpenGL views.
My first thought was to try to have different OpenGL contexts for each view, but that would complicate things because I wanted to share the same textures and other resources. I know there’s a shared groups option, but that was definitely not the way to go.
The best solution I found was to use multiple frame buffers, binding each of them to the correct OpenGL view. That way, when I switch views, I switch frame buffers and everything works correctly.
Simple once you know how, isn’t it?
h/t: iPhoneKicks!
FEB