我可以在 iPhone 应用程序上将 OpenglES 与标准 Cocoa 小部件混合使用吗? [英] Can I mix OpenglES with standard Cocoa widgets on an iPhone app?

查看:18
本文介绍了我可以在 iPhone 应用程序上将 OpenglES 与标准 Cocoa 小部件混合使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果这是可能的,很高兴看到一些例子!

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

谢谢,瑞

推荐答案

这个问题提出了一些非常相似的问题,正如我所说,让 OpenGL ES 内容与 UIKit 控件共存是微不足道的.OpenGL ES 内容位于支持 UIView 的 CAEAGLLayer 中,它是普通视图层次结构的一部分.您可以轻松地在其上覆盖其他 UIView.

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.

例如,您可以查看我的 Molecules 应用程序的源代码,其中我在我的 OpenGL ES 视图顶部放置了两个 UIButton.

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.

在我的基准测试中,通过将其他视图放置在 OpenGL ES 视图之上,您会损失约 1-5% 的 OpenGL 帧速率,这并不算太糟糕.您不想做的是让您的 OpenGL ES 上下文不透明,并尝试将其覆盖在其他视图元素之上,因为这样您会看到渲染速度显着下降.

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.

这篇关于我可以在 iPhone 应用程序上将 OpenglES 与标准 Cocoa 小部件混合使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆