GLFW fails to use WGL system-wide when I have specific second monitor connected

As I was developing my application using glfw, it stopped starting with those messages:

GLFW Error 65544: WGL: Failed to make context current
GLFW Error 65543: WGL: A forward compatible OpenGL context requested but WGL_ARB_create_context is unavailable
GLFW Error 65544: WGL: Failed to clear current context

I was using precompiled library packed with ImGui. GLFW crashed in glfwCreateWindow().

So… I checked the source code of GLFW for any hints and got nothing. Then i tried to open The Binding of Isaac: Repentance, wich also uses GLFW, and it silently crashes and leaves a crash dump
isacc crash minidump

When I disconnect my monitor, everything works fine.

Edit: forgot to mention that the failing function in isaac dump was WglMakeCurrent(). So, when i called GetLastError() in my application (with hope there is the same problem) it returned ERROR_INVALID_HANDLE(6)

Specs:
Laptop: HP ProBook 445 G7
CPU: AMD 4500U
Graphics: Integrated
Display: LG D2343 (connected via HDMI)
OS: Windows 10 22H2
RAM: 16Gb DDR4

HI @Lombeelo, welcome the GFLW forum,

That is very odd, I’ve not seen this behaviour before simply due to connecting a monitor.

WglMakeCurrent is a win32 function, so this failing is really low level and there’s not much GLFW can do, unless somehow GLFW has set up the context incorrectly, though I would have expected an earlier error for that.

  1. Could you try updating drivers in case this might be the issue?
  2. Do you have any other OpenGL programs which do not use GLFW which work when the monitor is attached?
  3. I am supposing you have 2 monitors (laptop+external) attached with both displaying. Which is the primary monitor in this case and does changing that change the issue?
  4. How exactly do you launch + observe the issue the application?
  5. Could you run DXDiag and check the Display tab Notes for any reported issues?

Thank you for your reply. I tinkered with my computer a bit more and found out that deleting drivers for all displays + GPU in device manager then restarting helped me. I will write all other things you asked me just in case it will help make GLFW better.

  1. When I tried deleting opengl32.dll I found out that steam was using it and was working totally fine
  2. Yes I use exact setup, laptop display is primary
  3. Isaac was launched from steam and immediatly crashed without any messages and minidump file was generated by the game itself. It’s attached in first post. Also I was launching my own application from Visual Studio 2022 wich compiled with precompiled GLFW library in ImGui repository link (github.com). Error message is in the first post
  4. Checked it before fix - there were no issues.

I tinkered with my computer a bit more and found out that deleting drivers for all displays + GPU in device manager then restarting helped me.

So you have resolved the issue completely?

When I tried deleting opengl32.dll

I would not recommend deleting opengl32.dll, this is a system dll which comes with Windows. The actual OpenGL driver is installed with your GPU drivers.

Yes, issue was resolved.