The problem is on Mac but also on most open source drivers which are in OpenGL 2.1 (Mesa…).
From what I understand, the problem is “only” with GLSL. So we can do two version of the shader and, following what OpenGL GLEW return, use one or the other.
This is something I’ve seen in OpenGL video game. You have files like this: toto.120.vtx, toto.130.vtx, toto.140.vtx, etc… This are shaders vertex files with version and the system will launch the one they want…
As I’m not very experienced with such problem, I ask you guys what do you think it’s the better idea to deal with that?
Big thanks in advance all!
Regards,
Dorian
PS: There is some move in the Open source drivers for OpenGL 3.0 drivers but it will not be soon…
Actually, every OpenGL 3 functions I use are supported by most OpemGL 2.1 driver (using extensions).
It’s a “pragmatic” decision: If Every function I use are not OpenGL 2.1 but are supported by almost every OpenGL 2.1 driver, why should I prevent user to use this software?
That’s why I won’t prevent user to use this software if he is OpenGL 2.1.
The problem is only GLSL and I would like to have your professionnal point of view on how deal with that…
About “#version”, if I tell “#version 130”, it just doesn’t compile on GLSL 1.2. That’s why I was thinking to do as in video game and have many shader file to load only if the hardware support it.
Provide two sets of shaders, for example for GLSL versions 1.20 and 1.50. Detect supported GLSL version at runtime and choose which version to use. Simple, effective and flexible, but high cost to maintain.
Provide a single set of shaders, and patch them to match supported GLSL version. Again, detect supported GLSL version at runtime, then apply patching as needed. Simple string replacements is often enough.
Use GLSL preprocessor to deal with GLSL version differences. For example