Qt OpenGL Initialization Fails ONLY when not connecting a 2nd Monitor
-
Hello.
I'm developing a VR Application. For this I'm Using an HP Z Fury Laptop and an HP Reverb G2 Headset. The laptop itself contains a Quadro RTX 4000 with Max-Q Design and of course an Integrated Intel Graphics Driver which I disabled in the Device Manager when I originally got my laptop.
I developed my entire application with both the HMD connected to it's mini dsiplay port mode and a 22 inch monitor connected to its HDMI port.
I'm using Qt 5.13.2 with MSVC2019.
So far so good.
However I had to run some tests withouth the 22 inch monitor and I discovered that my application failed to start and what's more I had the following messages which I never saw (and still don't see) if the second monitor is plugged in:
QWindowsEGLContext: ANGLE only partially supports OpenGL ES > 3.0 QWindowsEGLContext: Failed to create context, eglError: 3005, this: 0x15bea685070
The code that fails is the open GL context initialization:
QSurfaceFormat format; format.setMajorVersion( 4 ); format.setMinorVersion( 1 ); format.setProfile( QSurfaceFormat::CompatibilityProfile ); openGLContext = new QOpenGLContext(); openGLContext->setFormat( format ); if( !openGLContext->create() ){ logger.appendError("Open GL Context initialization failed"); return false; }
So basically openGLContext->create() fails when I don't have the second monitor connected and does not fail when I do.
I have tried going into the Device Manager and setting the Base Profile in the Global Settings to High-performance NVIDIA processor but no change.
Can anyone give me a clue as to what can be happening and how to fix it? Ideally this should work with and withouth a second monitor.
-
So In case anyone comes across this. I figured out the issue but it makes littles sense.
As I said in my question I had deactivated my Intel UHD Adapter.
However upon exploring on windows Graphics/Display Settings I saw that actual screen for the laptop was connected to "Microsoft Display Adapter" while the HMD was connected to the NVIDIA Graphics Card.
So on a whim I enabled the UHD adapter and and now the Windows Advaced Display Settings tell me that the laptops screen is connected to the Intel UHD Driver. (Instead of the Microsoft Display Adapter).
Now the code works, withouth having to connect a second monitor but it's weird. The stuff gets displayed on the VR Helmet, which is indicated everywhere that I can see, to be connected to the NVIDIA Graphics Card, but the OpenGL Initialization is somehow happening because of the Intel UHD Driver?
The message clearly gives the idea that the lack of OpenGL was the problem which makes sense given that the Microsoft Display Adapter would not have it. But I still don't understand how it works. And I feel I'm missing an important piece fo the puzzle. If anyone could shed some light that would be greatly appreciated.