Can I mix OpenglES with standard Cocoa widgets on an iPhone app?

故事扮演 提交于 2019-12-18 04:21:42

问题


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

Thanks, rui


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3057529/can-i-mix-opengles-with-standard-cocoa-widgets-on-an-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!