Core And Compatibility in Contexts

From OpenGL.org
(Redirected from Core)
Jump to: navigation, search

OpenGL version 3.0 introduced the idea of deprecation; some sections of the specification could be marked as deprecated. This means that they can be removed from the core specification in later versions, which happened in version 3.1.

However, since many implementations support the deprecated and removed features anyway, some implementations want to be able to provide a way for users of higher GL versions to gain access to the old APIs. Several techniques were tried, and it has settled down into a division between Core and Compatibility

OpenGL 3.1 and ARB_compatibility

A new extension, ARB_compatibility, was introduced when OpenGL 3.1 was revealed. The presence of this extension is a signal to the user that deprecated or removed features are still available through the original entrypoints and enumerations. The behavior of such implementations is defined with a separate, much larger, OpenGL Specification. Thus, there was a backwards-compatible specification and a non-backwards compatible specification.

OpenGL 3.2 and Profiles

When OpenGL 3.0 was introduced, a new context creation mechanism was introduced as well. Since later versions could remove functionality, it was important that the user be able to ask for a specific version of OpenGL, one that they had written their code against.

However, the ARB_compatibility extension posed a problem: the implementation decided whether to define it or not. A user could not ask to not have ARB_compatibility; it was forced on them. This also meant that the core specification had to be a subset of the compatibility specification; the core specification couldn't provide functionality that the compatibility one did not provide.

Thus, another change was made to context creation.

The 3.0 form of context creation allows the user to ask for a profile. Initially, only one profile was available: core. In 3.2, a new profile was added: compatibility. An implementation is only required to define core, so compatibility is not guaranteed to be available. However, it's a safe bet that it is (unless you're using Mac OSX 10.7, in which case 3.2 core or 2.1 are your only choices).

The 3.2 wording also changed, allowing 3.0 and higher contexts to be given when not directly asked, so long as they support ARB_compatibility or are the compatibility profile of that version of OpenGL. So if you ask for 2.1, the implementation is free to give you 3.2 compatibility; it was not previously free to do this.

Because of the change in wording, the way to detect the changed functionality is to check the extension string. If WGL_ARB_create_context_profile is present, then it uses the 3.2 wording. Otherwise it uses the 3.0/3.1 wording.

Forward compatibility

A context, of version 3.0 or greater, can be created with the "forward compatibility" bit set. This will cause, for the given profile, all functionality marked "deprecated" to be removed. You can combine the forward compatibility bit with core and compatibility contexts.

For 3.0, this means that all deprecated functionality will no longer be available. This simulates the 3.1 experience.

For 3.1, this means that any remaining deprecated functionality (things deprecated in 3.0 but not removed in 3.1) will be removed. Basically, wide-lines. Also, you're not likely to see implementations offer ARB_compatibility if you pass forward compatibility.

For 3.2+ compatibility, it should mean nothing at all. Since no functionality is marked deprecated in the compatibility profile, the forward compatibility bit removes nothing.

For 3.2+ core, it again means that all functionality that is still deprecated (wide-lines) will be removed.

Ultimately, you should never use the forward compatibility bit. It had a use for GL 3.0, but once 3.1 removed most of the stuff, it stopped having a use.