PDA

View Full Version : wglCreateContextAttribsARB not needed anymore?



soconnell
10-18-2013, 07:25 AM
Is wglCreateContextAttribsARB not needed anymore? I just recently noticed with the latest drivers from both NVIDIA and AMD that just calling wglCreateContext gives me access to all OpenGL versions and associated extensions up to the version supported without having to call wglCreateContextAttribsARB. Is this a bug or was it intended? Has anybody else experienced this?

Aleksandar
10-18-2013, 09:47 AM
It is needed, more than ever before. There are several attributes/flags that cannot be set without that function.

wglCreateContext should make non-debug compatibility non-forward profile/context. If it is so, there is no bug.

soconnell
10-19-2013, 05:22 AM
I'm fully aware of what the specification says for the expected behavior of wglCreateContextAttribsARB and its uses. However that wasn't my question. My question was really whether or not anybody else has experienced this behavior.

Aleksandar
10-19-2013, 06:21 AM
I'm really sorry my English is so bad that you cannot understand me (and even I didn't understand what you wrote). There are three questions and I'll explicitly answer to each one.


Is wglCreateContextAttribsARB not needed anymore?
It is needed since there is no other way to define context's attributes.


I just recently noticed with the latest drivers from both NVIDIA and AMD that just calling wglCreateContext gives me access to all OpenGL versions and associated extensions up to the version supported without having to call wglCreateContextAttribsARB. Is this a bug or was it intended?
It is intended behavior.


Has anybody else experienced this?
Yes

There is a clear state in the spec:


...
When this extension is supported, calling

wglCreateContext(hdc)

is equivalent to calling

wglCreateContextAttribs(hdc,0,NULL).
...
The legacy context creation routines can only return OpenGL 3.1
contexts if the GL_ARB_compatibility extension is supported, and can
only return OpenGL 3.2 or greater contexts implementing the
compatibility profile. This ensures compatibility for existing
applications. However, 3.0-aware applications are encouraged to use
wglCreateContextAttribsARB instead of the legacy routines.

Dark Photon
10-19-2013, 08:51 AM
...*CreateContext gives me access to all OpenGL versions and associated extensions up to the version supported without having to call *CreateContextAttribsARB. Is this a bug or was it intended? Has anybody else experienced this?
Intended (for backward compatibility), and yes. If compatibility profile alone is all you need, just use *CreateContext and be happy.

However, *CreateContextAttribs is useful for creating a debug profile if nothing else (produces perf tips from the driver on what you're doing). You can also target a specific OpenGL version. And/or if you're a purist, you might want to target the core profile which keeps you from using any of the deprecated features.

kRogue
10-23-2013, 02:23 PM
For NVIDIA and ATI, if you just want features then *CreateContext is fine.

But, for Intel with Mesa under Linux, using glxCreateContext will give one a GL3.0 context; if you want greater than 3.0 under Intel with Mesa (or really any driver implemented via Mesa) then you must use glxCreateContextAttribsARB AND select core profile. One important feature is that geometry shader development in Mesa has been geometry shaders as found in 3.2, not as found in GL_ARB_geometry_shader; so there is a real advantage of glxCreateContextAttribsARB over glxCreateContext for Mesa based GL implementations.