views:

689

answers:

4

Imagine an iPhone app, which starts with an standard UIView showing some buttons and stuff. Then there is a stats button, you tap it, and the UIView slides away. Instead an OpenGL ES view comes in, and shows a nice statistics curve.

I know you can mix OpenGL ES with UIView somehow but people say it's a bad idea. Does this also apply if the whole thing is fullscreen either openGL ES || UIView?

+1  A: 

You can definitely do this; I have an OpenGLES app that uses UIAlerts and UIActionSheets and it works fine. I think you just want to avoid doing something like having an OpenGL layer and then a bunch of UI elements and then another transparent OpenGL layer over that.

David Maymudes
+2  A: 

In my app I'm also mixing OpenGL and Cocoa UI elements with no bad results. Im even putting UIViews on top of an OpenGL view and the result is performing well. If you want to see it, in my profile you'll find a link.

Nikolai Ruhe
+1  A: 

Hi, I have been banging my head on the same :( Say in addMusic apple sample code... I want to have a 3d rotating cube withint the main page of addmusic/play appsound buttons and "your application here" message.

please show me a way, a sample tweak of addmusic code or some framework.

help much appreciated.

don, [email protected]

don
+1  A: 

On iPhone you always render into UIView, and this view can have subviews like any other.

There is no difference between having single OGL view and swapping many views(including one OGL view) with navigation controller or core animation.

Having some UI buttons or labels over OGL view won't slow your app down, but you must make sure they don't cover big portion of the screen and don't update their contents too frequently. It is bad idea to use fast-rolling score label, updated 20 times per second, for example. In this case you must either limit update speed, or use OGL-based UI controls.

Make sure your OGL view is configured as opaque and doesn't use pixel format with alpha, unless really needed. Alpha-blended OGL views are slow.

noop