Does wglCreateContext default version

I am wondering if anyone knows, and can point me to a reference that states whether or not the default version of OpenGL given by wglCreateContext will always give the highest version available. I have only been able to find forum postings that say it is usually the case. When would it not be?


Any context returned by wglCreateContext() will need to be backwards-compatible with previous versions of OpenGL. So if the implementation supports OpenGL 3 or later, it can’t return a 3.1 context or a 3.2+ core profile context.

AFAIK, all existing Windows implementations support both core and compatibility profiles for their highest supported version. But it’s not entirely inconceivable that an implementation may only provide a core profile context for the highest supported version; supporting the compatibility profile takes a lot of effort, and there’s progressively less reason to do so as the version increases.

So would it be correct to say that wglCreateContext will return the highest compatibility profile supported by the implementation? If I understand this bit

The default values for WGL_CONTEXT_MAJOR_VERSION_ARB and WGL_CONTEXT_MINOR_VERSION_ARB are 1 and 0 respectively. In this
case, implementations will typically return the most recent version of OpenGL they support which is backwards compatible with OpenGL 1.0
(e.g. 3.0, 3.1 + GL_ARB_compatibility, or 3.2 compatibility profile)

from correctly, then that would seem to be the case.

I am just wondering if the initial rendering context that is typically used to load the extensions can also be used as an easy check of the highest version supported by the implementation.

Thank you for your help.

It would be correct to say that implementations typically do that. The specification wouldn’t have used the word “typically” if it intended to mandate that behaviour.

If you want “recent” features, you should use wglChoosePixelFormatARB() and wglCreateContextAttribsARB() to request a specific version and profile. Modern applications have the choice of using that approach, while legacy applications were stuck with wglCreateContext(). So you should expect wglCreateContext() to do whatever happens to works best for legacy applications. It’s not entirely inconceivable that on a dual-GPU laptop implementation, wglCreateContext() might give you the highest version supported by the low-power GPU, with the high-performance GPU reserved for applications which specifically request a higher version.

Ultimately, what good does knowing the “highest supported version” do you? What is your application going to do with the knowledge that the implementation supports OpenGL 7.4? Right now, anything higher than 4.6 means that as well as the features which you can actually use, it also provides some additional functionality (but right now you don’t know what that functionality actually is).