Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lpetrich

macrumors member
Original poster
Nov 26, 2009
39
0
As we all know, Apple has officially deprecated OpenGL in its OSes, like iOS and macOS. However, we don't have any hints as to when it will disappear outright. Some people have asked what will become of all the software that was written to use OpenGL, and that is an important question. I do think, however, that it will be possible to get OpenGL support on Apple OSes, even if unofficial support.

Here is where we are now. The Khronos Group Inc has long managed and maintained the OpenGL standard, and it has recently introduced a new 3D-graphics API called Vulkan. It is somewhat lower-level than OpenGL, something that can give improved performance. Apple has recently introduced a similar sort of 3D API called Metal, an API that is to take OpenGL's place. Something like what Microsoft has long done with DirectX. Since Metal only runs on Apple's OSes, some people have worried that many developers would not be willing to port OpenGL-using apps to Metal.

But there is a solution. Use a library that translates OpenGL into Metal. There is a company that has already implemented that solution: MoltenGL | Metal performance with OpenGL ES. It is proprietary, but its creator has open-sourced its Vulkan-to-Metal translator, and the Khronos Group now maintains it: KhronosGroup/MoltenVK at GitHub.

But might someone write some open-source OpenGL-to-Metal translator? There already exists an open-source OpenGL implementation, The Mesa 3D Graphics Library, and it is being extended to implement Vulkan. So might Mesa eventually have an OpenGL-to-Vulkan translator?

So I think that there will be plenty of time to develop some open-source OpenGL-to-Metal translator before Apple drops OpenGL.
 
recently introduced a new 3D-graphics API called Vulkan
Apple has recently introduced a similar sort of 3D API called Metal

Your timing is a bit off. Apple introduced Metal in a usable state in mid 2014. The Vulkan specification was finalized early 2016. So Apple moved to Metal before Vulkan existed.

and it is being extended to implement Vulkan
So might Mesa eventually have an OpenGL-to-Vulkan translator?

That's not Mesa's focus. Why would it provide a translator when it supports both OpenGL and Vulkan side-by-side? And what good would that do on the Mac? Are you implying layering an OpenGL->Vulkan translator on top of MoltenVK or something?

So I think that there will be plenty of time to develop some open-source OpenGL-to-Metal translator before Apple drops OpenGL.

Anything is possible. Apple may not drop OpenGL for many years, depending on the importance they attach to applications using it and the rate at which they convert to Metal (directly or otherwise).
 
That's not Mesa's focus. Why would it provide a translator when it supports both OpenGL and Vulkan side-by-side? And what good would that do on the Mac? Are you implying layering an OpenGL->Vulkan translator on top of MoltenVK or something?
Mesa contains code for implementing both OpenGL and Vulkan, and it is open-source. So it could be used as a source for implementing an OpenGL-to-Vulkan translator.

Yes indeed, I am implying an OpenGL-to-Vulkan translator on top of MoltenVK.

Anything is possible. Apple may not drop OpenGL for many years, depending on the importance they attach to applications using it and the rate at which they convert to Metal (directly or otherwise).
Apple hasn't updated its implementation of it in some time, so if Apple decides to keep going with OpenGL, it may indicate doing so by updating its implementation.
 
Mesa contains code for implementing both OpenGL and Vulkan, and it is open-source. So it could be used as a source for implementing an OpenGL-to-Vulkan translator.

I imagine that modifying Mesa to implement translation in this way is a mammoth task, with no reward for anyone on the platforms Mesa supports. So good luck finding support for this in the open source community.

Yes indeed, I am implying an OpenGL-to-Vulkan translator on top of MoltenVK

And you expect this to perform well? Translating between 3 graphics APIs that function at different levels and have different feature sets? Possible? Sure. Fast? No.

it may indicate doing so by updating its implementation

This isn’t going to happen. Deprecated in this context doesn’t mean “going away now” but it does mean “won’t be updated at all, ever”.
 
Maintaining the OpenGL implementation with all its idiosyncrasies is a major pain. The best way forward is to have Apple focusing on high quality Metal drivers (much easier to achieve than for OpenGL) and provide legacy OpenGL support via an open source initiative. A GLSL to Metal SL translator already exists.
 
Maintaining the OpenGL implementation with all its idiosyncrasies is a major pain. The best way forward is to have Apple focusing on high quality Metal drivers (much easier to achieve than for OpenGL) and provide legacy OpenGL support via an open source initiative.
Something like XQuartz for X-windows.
A GLSL to Metal SL translator already exists.
So there is no need to use Vulkan's SPIR-V as an intermediate. That's Vulkan's shader language.

I must say that my experience with OpenGL is rather dated. I did a lot of work with it some 15 years ago, long before shaders became common. It was all fixed function, and though I liked using glDrawArrays() and glDrawElements(), it also supported glBegin() and glEnd().
 
But there is a solution. Use a library that translates OpenGL into Metal. There is a company that has already implemented that solution: MoltenGL | Metal performance with OpenGL ES. It is proprietary, but its creator has open-sourced its Vulkan-to-Metal translator, and the Khronos Group now maintains it: KhronosGroup/MoltenVK at GitHub.
There's an important point missing here: both MoltenGL and MoltenVK only support limited subsets of the standards.

MoltenGL translates to OpenGL ES. This is basically a somewhat stripped down version of OpenGL for mobile platforms, which is not fully equivalent to OpenGL. Furthermore, MoltenGL only supports OpenGL ES version 2.0, which is an 11 year old standard. The current version is 3.2

MoltenVK also is not a full implementation of Vulkan. It only supports the "portability subset", which has even less features than Vulkan's feature set for mobile GPUs.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.