PDA

View Full Version : OpenGL version of created context



checkcheck
02-26-2016, 02:18 PM
On my notebook when I create a new context with glXCreateContext I get a 4.5 version context.
I checked the version with the function glGetIntegerv and the parameters GL_MAJOR_VERSION / GL_MINOR_VERSION.

My question is:
When creating a new context with one of

glXCreateContext
wglCreateContext
eglCreateContext

do you always get a context with the maximum supported version?
Is it possible that glXCreateContext returns a 2.1 context if the driver supports 4.5?
Do glX/wgl/egl behave the same way?

My question is not how to create a context of a specific version with glXCreateContextAttribsARB.

Agent D
02-29-2016, 01:37 AM
I took a quick look at the GLX spec, and it doesn't actually say anything about the GL version of the context created. There is only an appendix that matches
GLX version with supported GL versions (going up to 1.3, so I guess it is a minimum?).

In my experience, the old context creation functions (not [glX|wgl|...]CreateContextAttribsARB) create the highest version available with compatibillity profile,
which is not neccesserily the highest available with core profile. For instance, on my system, mesa supports core profile up to 3.3, but compatibillity only up to 3.0,
so glXCreateContextAttribsARB can create a 3.3 core profile context, or a 3.0 compatibillity profile context, but glXCreate[New]Context always returns a 3.0 compatibilltiy
profile context. AFAIK, Mac OS X has a similar situation.

So yes, it is theoretically possible that glXCreateContext returns a 2.1 context (with compatibillity profile), even tough the driver supports up to 4.5 (with core profile only).

GClements
02-29-2016, 03:48 AM
In my experience, the old context creation functions (not [glX|wgl|...]CreateContextAttribsARB) create the highest version available with compatibillity profile,

That seems fairly logical, self-evident even. If they created a core profile context, legacy code (which doesn't know anything about profiles or glXCreateContextAttribsARB) would fail to work.

eglCreateContext() may behave differently, as EGL itself is a relatively new API.