Re:OpenGL is getting mesh shaders as well, via GL_EXT_mesh_s...
by jlokier on Friday October 10, 2025 @12:06PM
(#45540508)
Recent versions of macOS will provide either an OpenGL 2.1 context or OpenGL 4.1 context, depending on how you request the context. You have to request a 3.2+ core profile, and not use X11 or the glX* functions.
From macOS 10.7 to 10.9, you'd get an OpenGL 3.2 context. As OpenGL 4.1 is backward compatible to OpenGL 3.2, it's fine that the same code gets OpenGL 4.1 now.
Basically, macOS will provide an "old" API to programs that need it, which is fixed at 2.1, and a "modern" API to programs that know how to ask for it, which has settled at 4.1 and is unlikely to change.
OpenGL 4.1 is harmonised with OpenGL ES 2.0. Almost the same rendering model, features, extensions, etc. On iOS, iPadOS etc you can use OpenGL ES 2.0, and no version of OpenGL (non-ES), so my guess is that's why macOS settled on OpenGL 4.1. Both platforms offer the same OpenGL rendering features, but through slightly different APIs.
But if you request 4.1 over GLX (which uses X11/Xorg/XQuartz), the X11 code only supports OpenGL 2.1. For example, if you're porting some Linux code or other GLX examples over.
Unfortunately, the GLX limitation with macOS is probably just due to the Xorg-based XQuartz being open source but very minimally maintained. I looked at the source, and the calls and code paths are almost there for 4.1 support. It uses Xorg and Mesa, which have all the bindings. The standard function for requesting a 4.1 profile, glXCreateContextAttribsARB(), is even in the library and you can call it, but the extension flag GLX_ARB_create_context is disabled, and requesting a 4.1 profile (or 3.2) still returns 2.1.
From macOS 10.7 to 10.9, you'd get an OpenGL 3.2 context. As OpenGL 4.1 is backward compatible to OpenGL 3.2, it's fine that the same code gets OpenGL 4.1 now.
Basically, macOS will provide an "old" API to programs that need it, which is fixed at 2.1, and a "modern" API to programs that know how to ask for it, which has settled at 4.1 and is unlikely to change.
OpenGL 4.1 is harmonised with OpenGL ES 2.0. Almost the same rendering model, features, extensions, etc. On iOS, iPadOS etc you can use OpenGL ES 2.0, and no version of OpenGL (non-ES), so my guess is that's why macOS settled on OpenGL 4.1. Both platforms offer the same OpenGL rendering features, but through slightly different APIs.
But if you request 4.1 over GLX (which uses X11/Xorg/XQuartz), the X11 code only supports OpenGL 2.1. For example, if you're porting some Linux code or other GLX examples over.
Unfortunately, the GLX limitation with macOS is probably just due to the Xorg-based XQuartz being open source but very minimally maintained. I looked at the source, and the calls and code paths are almost there for 4.1 support. It uses Xorg and Mesa, which have all the bindings. The standard function for requesting a 4.1 profile, glXCreateContextAttribsARB(), is even in the library and you can call it, but the extension flag GLX_ARB_create_context is disabled, and requesting a 4.1 profile (or 3.2) still returns 2.1.