Request specific OpenGL version?

On Mac I’m trying to request a specific version of OpenGL before they deprecated client side vertex arrays (before 3.2 core) but I always get back version 4.1 from SDL. How can this be achieved?



writeln('OpenGL Version: ', glGetString(GL_VERSION));
writeln('GLSL Version: ', glGetString(GL_SHADING_LANGUAGE_VERSION));


OpenGL Version: 4.1 INTEL-10.28.26
GLSL Version: 4.10

On macOS, AFAIK you either get OpenGL 2.1, or a core profile with all of the deprecated stuff removed.
Just comment out your SDL_GL_SetAttribute calls and you should get 2.1.

There’s no way to get 3.x on Mac? Why not, is it a bug or just a Mac thing? If I remove those I get GLSL 1.2 which is hard to even learn because it’s so old and unsupported. I wanted to use GL 3.1 so I could use client side arrays and make ported some code easier but if I go above 3.1 it’s deprecated and removed.

It’s by design, AFAIK. For 3.x they only implement core profiles. Here is an explanation I found on reddit:

I see, thanks Eric. It just so happens 3.2 deprecated client side vertex arrays so I need to go legacy (which means I can’t use shaders for GLES) or go full 4.x . That sucks but I need to bite the bullet and upgrade everything now.