【问题标题】:How to get supported OpenGL ES versions available on any given iOS device at runtime?如何在运行时在任何给定的 iOS 设备上获得支持的 OpenGL ES 版本?
【发布时间】:2014-03-16 04:58:00
【问题描述】:

我正在寻找一种方法来获取支持的 OpenGL ES 版本列表或 iOS 设备上可用的最大 OpenGL ES 版本在运行时

理想的解决方案不得

  • 不检查特定设备型号

PS:项目设置: 基础 SDK = 最新 iOS (7.0) 部署目标:4.3

【问题讨论】:

    标签: ios opengl-es runtime opengl-es-2.0 opengl-es-3.0


    【解决方案1】:

    这样做的首选方法是尝试为各种 OpenGL ES 版本创建上下文,并在它们失败时回退到旧版本。例如,您可以使用以下命令检查 OpenGL ES 3 支持:

        EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
    

    如果 aContext 为 nil,则该设备不支持 OpenGL ES 3.0。然后你可以回退到

        aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
    

    测试 2.0 支持。如果失败(aContext 再次为零),则设备仅支持 OpenGL ES 1.1。这不需要您检查设备类型(它会考虑未来未发布的设备)。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    • 1970-01-01
    • 1970-01-01
    • 2014-04-29
    相关资源
    最近更新 更多