Clarification on a glfwCreateWindow remark for Windows

In the docs for glfwCreateWindow, the first remark is:

Windows: Window creation will fail if the Microsoft GDI software OpenGL implementation is the only one available.

I’m a little confused about what this means. I know Microsoft has implemented some interface in the Windows API to support OpenGL, but I thought the actual OpenGL implementation is dependent on the graphics card vendors. Like, Windows API provides the interface to get an OpenGL rendering context displayed on a window’s device context. And I’m pretty sure a graphics card vendor determines what version of an OpenGL implementation the card can support (like the OpenGL 3.3 implementation, or 4.0 implementation).

So that remark sounds like the Microsoft has developed some default OpenGL implementation that all graphics cards are supposed to support (1.1 I’m guessing, looking at this msdn overview). Is this true? If so, then does the remark mean that if in glfwCreateWindow, glfw finds it must use this “default-like” implementation provided by Microsoft, it’ll actually return a failure status? If that’s the case, why is that? Is there something wrong with this “default-like” implementation, or is glfw designed to encourage programmers to use later versions of OpenGL? Just curious.

Also, does this imply that OpenGL is an extension to Microsoft’s GDI? I thought they were two separate things.

1 Like

The default 1.1 GL implementation from MS doesn’t require anything from GPU. It is implemented purely in software - all the rendering happens on CPU. That’s why it is not very useful - it is very limited in functionality and very slow. It does not make much sense for glfw to support it.

Typically you will get MS 1.1 GL implementation when you don’t install any GPU driver - basically Windows loads this GL implementation by default when it does not know how to talk to real GPU hardware.

Another situation where this happens is when application is launched in Remote Desktop session - it typically doesn’t have access to GPU hardware.

1 Like

Oh ok, that makes sense. So MS’s 1.1 GL implementation works fine, it’s just that glfw is inclined not to support it because it runs slower on the CPU. And since Microsoft’s GDI runs on the CPU, I can see how it’d make sense to say that there is a default “Microsoft GDI software OpenGL implementation”, as a 1.1 CPU implementation on a GDI CPU graphics interface.

I’m curious as to how glfw can check for something like this. On Windows, would it check if it got a 1.1 implementation and conclude from there it got MS’s implementation, or is there a specific function on the Windows API that can check for something like this?

I’m glancing at the glfw source, in “src/window.c” in the github repo. I’m seeing on line 166 the function “_glfwIsValidContextConfig” and on line 200 “_glfwPlatformCreateWindow”. Could the check be done in one of these functions? They sound like functions for checking for something like this.

You check for that by creating GL context and then querying GL_RENDERER string. It will return something like “GDI Generic” or something similar. And you can check also GL_VENDOR - it should be “Microsoft Corporation”.

1 Like

Thanks. So using glGetString should work for a check like this. Can’t find anything like that in the glfw source, but still, thanks for the idea. I’m guessing however the library does this, it’s in “wgl_context.c”, looks like that’s where all the Windows API internal code is.