[英]OpenGl ES 3.0 Context not created on iPad (works in Simulator)
I'm working on a cross platform renderer for PC (Windows, Linux, Mac) and iOS. 我正在为PC(Windows,Linux,Mac)和iOS开发跨平台渲染器。 The iOS part is currently built around OpenGL ES 2.0 and I wanted to upgrade to ES 3.0.
iOS部分当前围绕OpenGL ES 2.0构建,我想升级到ES 3.0。 So I replaced the following line (that works)
所以我替换了以下行(有效)
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
with this line: 用这一行:
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
... and I included OpenGLES/ES3/gl.h and OpenGLES/ES3/glext.h. ...,我包括OpenGLES / ES3 / gl.h和OpenGLES / ES3 / glext.h。
In the simulator this works perfectly fine but running on the actual iPad it doesn't work anymore and the context is nil. 在模拟器中,它可以很好地运行,但是在实际的iPad上运行时,它不再起作用,上下文为零。
I really don't know what I'm missing here since the iPad is running the newest version of iOS (iOS 8.3) and shouldn't have problems with ES 3.0. 我真的不知道我在这里缺少什么,因为iPad正在运行最新版本的iOS(iOS 8.3),并且ES 3.0应该没有问题。 I don't get any errors and I can't really debug it (“Step into” doesn't seem to work here).
我没有收到任何错误,也无法真正调试它(“进入”似乎在这里不起作用)。
The features that OpenGL ES 3 adds over OpenGL ES 2 are hardware dependent, so you can create an ES3 context only on hardware that supports it. OpenGL ES 3在OpenGL ES 2之上添加的功能取决于硬件,因此您只能在支持它的硬件上创建ES3上下文。 If you get back
nil
when creating a context, you need to fall back to rendering with OpenGL ES 2. 如果在创建上下文时返回
nil
,则需要使用OpenGL ES 2进行渲染。
The iOS hardware that supports ES3 is anything with an A7 or better GPU. 支持ES3的iOS硬件可以是具有A7或更好GPU的任何硬件。 That's iPad Air, iPad Air 2, iPad mini 2 & 3, iPhone 5s, 6, & 6 plus... and presumably anything that comes later.
这就是iPad Air,iPad Air 2,iPad mini 2和3,iPhone 5s,6和6 plus ...以及以后可能出现的任何东西。
Note that the GPU requirement for ES3 is the same as that for Metal, so if you're going to do multiple renderers with a fallback path anyway you might want to just go all-out to get the best possible performance for those devices. 请注意,ES3的GPU要求与Metal的要求相同,因此,无论如何,如果要使用后备路径进行多个渲染器,则可能要全力以赴,以使这些设备获得最佳性能。
Note also that many of the features that are part of the core OpenGL ES specification in ES3 are still available in iOS as extensions under ES2. 还要注意,ES3中作为OpenGL ES核心规范一部分的许多功能仍在iOS中作为ES2下的扩展提供。 So you can stick to ES2 and support all devices if you're just looking for, say, instancing.
因此,如果您只是想实例化,则可以坚持使用ES2并支持所有设备。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.