OpenGL versions on OSX

I’ve had a few of my testers try out the mac build of my game and it always seemed to crash on startup because one of my shaders used only a glsl150 technique with no fallback.

It was odd though since the testers’ gpus support even opengl 4.5 and should compile the shader just fine. But then I found this on stackoverflow:

MacOS uses Legacy Profile as default for all created OpenGL context. Therefor by default only OpenGL up to 2.1 and GLSL up to 1.20 is supported.

So apparently osx can’t compile glsl150 out of the box? Is there a guy at Apple that implemented this saying, “Yes this seems like an excellent idea!”.

I looked at some old threads and some people suggested that this line could force macs to use the Core Profile:

settings.setRenderer(AppSettings.LWJGL_OPENGL3);

Apparently that just forces all shaders into glsl150 mode and crashes the glsl110 only shaders claiming they’re deprecated.

So yes, the obvious solution is to write fallbacks on the crashing shader for glsl110 but I’m just wondering if there’s any sort of way to enable dynamic opengl switching on macs?

Also in reality are there any medium range gpus left that don’t support opengl3.2? I feel like for the amount of power that my game needs I wouldn’t even need to write 110 fallbacks at all and just use 150.

yeah never seen more that ogl2.1 on a mac…
probably because it’s amazing… or… that’s the natural version…idk, but that must be for a very good reason.

Yeah by default, that’s what you get I suppose. It’s ironic how a company that claims to pride itself on design won’t even make one of the main three graphics libs run properly. Perhaps they didn’t have enough courage to let people use the new versions. :wink:

Here’s the stackoverflow thread btw. The guy answering is being kind of vague on how to get this working, but from what I can tell you need to set a command parameter on launch. Or something.

I will check it on MacOS from my iOS develop department :slight_smile: How I remember, OpenGL 3 with core profile on LWJGL3 works fine.

Could you explain me, how does render decide which shader need to use if we have two Techniques with the same name but they have different GLSL versions in a material definition? For example:

Deferred.j3md

Technique {
        LightMode MultiPass

        VertexShader GLSL100:   Common/MatDefs/Light/Deferred.vert
        FragmentShader GLSL100: Common/MatDefs/Light/Deferred.frag

        WorldParameters {
            WorldViewProjectionMatrix
            WorldViewMatrix
            ViewMatrix
            CameraPosition
        }

        Defines {
            ATTENUATION : Attenuation
            V_TANGENT : VTangent
            MINNAERT  : Minnaert
            WARDISO   : WardIso
            LOW_QUALITY : LowQuality
            HQ_ATTENUATION : HighQuality
            COLORRAMP : ColorRamp
        }
    }

    Technique {
        LightMode MultiPass

        VertexShader GLSL150:   Common/MatDefs/Light/Deferred.vert
        FragmentShader GLSL150: Common/MatDefs/Light/Deferred.frag

        WorldParameters {
            WorldViewProjectionMatrix
            WorldViewMatrix
            ViewMatrix
            CameraPosition
        }

        Defines {
            ATTENUATION : Attenuation
            V_TANGENT : VTangent
            MINNAERT  : Minnaert
            WARDISO   : WardIso
            LOW_QUALITY : LowQuality
            HQ_ATTENUATION : HighQuality
            COLORRAMP : ColorRamp
        }
    }

It takes the most appropriate one. It checks the supported glsl version of your hardware and select the shader with the closest inferior or equal version.

Thanks :slight_smile:

Since the last years OSX support OpenGL 4.1.
The drivers are decent, but not good and they always lag behind the sepc several years
Take note though that the 4.1 and OpenGL 3.3 suppoprt are only core profile. Many libraries (jME also?) requests compatibility profiles you won’t get access to the newer versions.
I have not had any problems accessing 3.3 or 4.1 features when requesting core profiles.

2 Likes

mhhh maybe we should do something about it in the core then…

4 Likes