And the compatibility profile is backwards-compatible with all prior versions of OpenGL.īut implementations are not required to support the compatibility profile of OpenGL, only the core profile. So 3.2 core profile is backwards-compatible with 4.6, and everything in-between. Now, all versions of OpenGL for each profile are backwards-compatible with all lower versions of the API for that profile. For example, 2.0 lacks vertex array objects, and core profile OpenGL cannot work without them. Indeed, this is the entire point of the core/compatibility distinction: the compatibility profile provides access to the higher features of the API while being backwards compatible with existing code. However, the core profile of OpenGL 3.2+ is not backwards compatible with 2.0.
That is, to ask for X.Y means "I have written my code against GL version X.Y, so don't give me something that would break my code." If you ask for OpenGL version X.Y, the system can give you any supported version of OpenGL which is backwards compatible with X.Y.
If there is no better general solution, I would like to know how it works in practice with different drivers on different platforms. How do I handle this problem? Do I have to try all the versions 4.6, 4.5, 4.4, 4.3, 4.2, 4.1, 4.0, 3.3, 3.2, 3.1, 3.0, 2.1, 2.0 in a loop until the context is successfully created? Or is there a better solution? There I have to request a core forward compatible context of some specific version, even though I don't want a specific version, I want the latest one. It seems that on Windows there won't be a problem, because I can just omit the version and the profile and automatically get a compatibility context with the latest supported version.īut things work differently on macOS and with Mesa. This means that it can live with 2.0 but prefers the latest supported version to be able to use all the available features from OpenGL 3.x-4.x.Īlso, it handles all the differences between core and compatibility contexts, so it should work with any profile. I'm developing an application that can use any OpenGL version from 4.6 down to 2.0 by gradually disabling some features and optimizations.