在OSX Big Sur上使用OpenGL 4.x开发 [英] Develop using OpenGL 4.x on OSX Big Sur

查看:109
本文介绍了在OSX Big Sur上使用OpenGL 4.x开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Apple的说法, OpenGL不再受支持.但是,截至7月28日,似乎在许多设备上都支持OpenGL v4.1 我有2020 Macbook Pro 16".型号,该型号不会出现在上面提供的列表中.虽然我确定我的设备上存在某种形式的兼容性,但我不确定当现代版本被弃用时如何使用 OpenGL 进行开发.

According to Apple, OpenGL is no longer supported. However, it appears v4.1 of OpenGL was supported on many devices as of July 28, 2020. I have a 2020 Macbook Pro 16" model, which does not show up on the list provided above. While I am sure some form of compatibility exists on my device, I am unsure how I can develop with OpenGL when modern versions are deprecated.

我希望在运行Big Sur的Macbook Pro和Windows台式机之间进行开发.因此,我显然不希望专注于特定于设备的库,例如Direct3D或Metal.尽管Apple没有直接提供支持,但是否可以使用较新版本的OpenGL(例如OpenGL 4.6)?我听说 AMD 显卡不能很好地与 OpenGL 配合使用,那么我还有什么选择?

I wish to be developing between my Macbook Pro running Big Sur and my Windows desktop. For this reason, I obviously do not wish to focus on a device-specific library such as Direct3D or Metal. Is it possible to work with newer versions of OpenGL (such as OpenGL 4.6) despite support not being directly provided by Apple? I've heard AMD video cards do not play well with OpenGL, so what options am I left with?

推荐答案

macOS上的内置OpenGL与Windows或Linux等其他平台有些不同.在Windows上,系统提供的 opengl32.dll 实际上并未实现OpenGL,而是一个代理库,可从图形卡供应商提供的驱动程序动态加载功能.图形卡供应商提供独立于Microsoft的驱动程序,并且无需Microsoft批准即可实现OpenGL功能.

Built-in OpenGL on macOS works a little bit different from other platforms like Windows or Linux. On Windows, system-provided opengl32.dll doesn't actually implement OpenGL but is rather a proxy-library dynamically loading functions from a driver provided by a graphics card vendor. Graphics card vendors provide drivers independently from Microsoft and OpenGL capabilities can be implemented without Microsoft approval.

相反, macOS 是封闭得多的系统,其中所有图形驱动程序都是系统的一部分,并且(通常)不能在不更新系统本身的情况下进行更新.Apple完全控制系统中的OpenGL功能,并且没有提供图形卡供应商任何方式向用户提供更多最新的OpenGL功能(即使他们的硬件在其他系统上支持它们也是如此).

In contrast, macOS is much more closed system, where all graphic drivers are part of the system and cannot be (normally) updated without updating system itself. Apple holds the full control over OpenGL functionality in system and doesn't give graphics card vendors any way to deliver users more up-to-date OpenGL features (even when their hardware supports them on other systems).

对于多平台软件的开发人员来说,这是非常不愉快的情况,因为苹果一直在稳步推进其平台特定的API,例如 Metal ,这意味着更强大的供应商锁定和/或更昂贵的开发.

This is quite unpleasant situation for a developer of multi-platform software, as Apple steadily pushes to their platform-specific APIs like Metal as the only choice, which implies a stronger vendor-lock and/or a more expensive development.

直接使用特定于平台的API的替代方法可以是使用代理库在特定于平台的API之上实现多平台API.到目前为止,当前已知的选项:

An alternative to using platform-specific APIs directly could be using a proxy-library implementing a multi-platform API on top of platform-specific API. So far, currently known options:

  • Apple在Metal上的OpenGL实现.不幸的是,它一直停留在 OpenGL 4.1 上,没有理由期望该版本能够长大.该库甚至可以在某些较新的macOS中删除.您可能已经注意到,现代macOS版本上的系统库提供的信息提到了Metal,因此它已经是其他图形API的包装(尽管Apple可能会通过访问某些内部组件来作弊).
  • MoltenVK ,这是开源的 Vulkan 金属上实现strong> 1.1实施.这不是OpenGL库,但是Vulkan是另一个多平台图形API,一些参考资料表明,当前状态下的MoltenVK足以在实际项目中使用,并且Vulkan 1.1有望提供比过时的OpenGL 4.1更多的功能(尽管,我无法亲自确认这一点,只是我的期望.)
  • MoltenGL ,它是基于 Metal 的开源OpenGL ES 2.0实现.由于当前的实现仅限于OpenGL ES 2.0(例如,比Apple内置的OpenGL/OpenGL ES库要低得多),因此它看起来毫无用处...
  • Google ANGLE ,这是开源的 OpenGL ES实现.到目前为止,ANGLE仅在Metal上实现OpenGL ES 2.0,而在Vulkan上实现OpenGL ES 3.1(正在进行3.2).因此,如果层不会爆炸,则理论上可以提供更多的层(例如MoltenVK);).但是,与OpenGL 4.1相比,即使OpenGL ES 3.2看起来也不够好.还有 MetalANGLE -ANGLE库派生,添加了iOS支持和一些其他功能功能.
  • Zink ,一种OpenGL开源实现在Vulkan.Zink已在Linux上实现 OpenGL 4.6 (受支持的OpenGL版本取决于公开的Vulkan功能和扩展).正在使此 Mesa Gallium驱动程序在工作中
  • Apple's OpenGL implementation over Metal. Unfortunately, it has stuck on OpenGL 4.1, and there is no reason to expect the version will ever grow up; the library could be even removed in some newer macOS. You may already notice that information provided by a system library on modern macOS versions mentions Metal, so that it is already a wrapper over other graphics API (although Apple may cheat by accessing some internals).
  • MoltenVK, an open-source Vulkan 1.1 implementation over Metal. This is not an OpenGL library, but Vulkan is another multi-platform graphics API and some references tells that MoltenVK in current state is solid enough for using in real projects, and Vulkan 1.1 is expected to give more features than outdated OpenGL 4.1 (though, I cannot confirm this personally, just my expectations).
  • MoltenGL, a closed-source OpenGL ES 2.0 implementation over Metal. As current implementation is limited to OpenGL ES 2.0 (e.g. much lower than Apple's built-in OpenGL / OpenGL ES libraries), it looks quite useless...
  • Google ANGLE, an open-source OpenGL ES implementation over other APIs. So far, ANGLE implements only OpenGL ES 2.0 over Metal, and OpenGL ES 3.1 (3.2 in progress) over Vulkan. So that with more layers like MoltenVK it could theoretically give more, if layers will not blow up ;). However, even OpenGL ES 3.2 doesn't look good enough compared to OpenGL 4.1. There is also MetalANGLE - an ANGLE library fork adding iOS support and some extra features.
  • Zink, an open-source OpenGL implementation over Vulkan. Zink already implements OpenGL 4.6 on Linux (supported OpenGL version depends on exposed Vulkan features and extensions). There is a work-in-progress making this Mesa Gallium driver working on top of MoltenVK on macOS.

对我来说,一段时间内坚持使用 OpenGL 4.1 (苹果公司提供)是一个不错的选择,以防您的应用程序失去一些需要更高版本OpenGL的功能.尽管Apple已弃用SDK中的OpenGL,但到目前为止,在新的macOS更新中将其在不久的将来实际删除似乎是不现实的.甚至 Apple M1 GPU在OpenGL 4.1上也得到了支持macOS Big Sur.不知道Apple是否有一些使用AppStore市场上已弃用的API的策略应用程序列入了黑名单(例如,系统将支持OpenGL,但您将无法在AppStore上发布应用程序),但这在将来可能会成为一个问题.替代的 OpenGL 4.6 实现(在Metal之上或在Vulkan-on-of-Metal之上)可能会在很遥远的将来出现.

To me, it looks that sticking to OpenGL 4.1 (provided by Apple) for a while is quite a good option in case if your application may afford losing some features requiring higher version of OpenGL. Although Apple has deprecated OpenGL in SDK, so far it looks non-realistic that it will be actually removed in nearest future within newer macOS updates; even Apple M1 GPU received OpenGL 4.1 support on macOS Big Sur. Don't know if Apple has some strategy black-listing applications using deprecated APIs from AppStore market (e.g. system will support OpenGL, but you will not be able publishing application on AppStore), but this might become an issue in some future. Alternative OpenGL 4.6 implementations (on top of Metal or on top of Vulkan-on-top-of-Metal) might come in some distant future.

依靠 Vulkan -on-top-of-of-metal实现可能是最临时的选择,但是无疑需要更多的努力才能在Vulkan之上而不是OpenGL上开发图形引擎.但是,无法评论当前的 MoltenVK 实现如何与 Windows 上相同图形硬件的本机 Vulkan 实现相媲美(按功能/性能/限制).当然,使用一些已经在多个图形 API(Vulkan/Metal/Direct3D/OpenGL/OpenGL ES)之上实现的现有图形引擎也会减轻您的维护负担,但这超出了初始问题的范围.

Relying on Vulkan-on-top-of-Metal implementations might be most provisional choice, but it will certainly require more efforts to develop a graphics engine on top of Vulkan instead of OpenGL. Cannot comment, though, how current MoltenVK implementation is comparable to native Vulkan implementations on Windows for the same graphics hardware (by features/performance/limitations). Of course, using some existing graphics engine already implemented on top of several graphics APIs (Vulkan/Metal/Direct3D/OpenGL/OpenGL ES) will also take this maintenance burden from you, but this is out of scope of initial question.

这篇关于在OSX Big Sur上使用OpenGL 4.x开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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