Qt [c++] - No Qt3D rendering on older laptop
-
Hello Folks!
I developed a game which uses the Qt3D Engine to display a custom 3D scene.
I was now copying the programm on an older Machine (Win11, i5, 4GB Ram) and the program starts properly.
Unfortunately, the 3D Scene is not rendering (the QT3D widget remains empty).
I also installed some OpenGL drivers from Microsoft [https://apps.microsoft.com/detail/9nqpsl29bfff?hl=de-DE&gl=DE]What am I missing to set up for Qt3D to render a scene?
best regards, kevin_d
-
Try this:
extern "C" { __declspec(dllexport) unsigned long NvOptimusEnablement = 1; __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1; } -
Hi!
Thanks for the tip. Unfortunately, that did not do the trick.
According to https://forum.qt.io/topic/50936/qt-5-4-sending-qdebug-to-a-file-40-aka-logging-41-solved/5, I am tracing the warnings, which say:{Warning:} D3D11 smoke test: Failed to create vertex shader
{Warning:} Initializing RHI with DirectX backend
{Warning:} RHI: Unable to use requested RHI Api, trying to fall back on OpenGL
{Warning:} Initializing RHI with OpenGL backend
{Warning:} QOpenGLContext::makeCurrent() called with non-opengl surface 0x190509c29d0
{Warning:} QRhiGles2: Failed to make context current. Expect bad things to happen.My DirectX Version is locally at 12
best regards, kevin_d
-
hi!
On a working machine, i get a "WARNING - Initializing RHI with DirectX backend" ...
I also installed additional DirectX-components according to https://www.microsoft.com/en-gb/download/details.aspx?id=35, but it fails nevertheless.
~kevin_d -
I was intrigued enough by the posted RHI warning text lines that I thought I would poke around in Qt source code for clues.
Disclaimer: I do not currently work on any program on Windows (nor DirectX specifically), so I have not attempted to reproduce this nor to run anything on Windows at all at the moment.
Based on reading source code, (and depending which Qt version—here I have assumed 6.10), it seems like in order for this to happen:
{Warning:} Initializing RHI with DirectX backend {Warning:} RHI: Unable to use requested RHI Api, trying to fall back on OpenGLThe Qt method
bool QRhiD3D11::create(QRhi::Flags flags)has to returnfalse.You can see the body of the method here: https://github.com/qt/qtbase/blob/v6.10.2/src/gui/rhi/qrhid3d11.cpp#L197-L419
This suggests at least two potential paths toward a deeper diagnosis:
- Make sure Visual Studio has access to Qt framework debug symbols and source code, and step through
QRhiD3D11::createin a debugger. - Try to write a (non Qt) small DirectX "hello world" that uses functions like
createDXGIFactory2anddxgiFactory->EnumAdapters1(which are the functions that Qt is trying to use under the hood).
In option (2), the idea is that if you directly write some DirectX code (in a separate
mainthat does not use Qt at all), then you can perhaps more quickly discover what part of DirectX is failing to cooperate.I offer this in the spirit of brainstorming. Again, I am not actively developing any Windows/DirectX codebase at the moment, so my advice is certainly not "expert" in that regard. However, I have done such work in years past, and I have used the approaches (1) and (2) successfully in the past to debug similar scenarios where it was not clear to me whether Qt was misbehaving or whether something nested "underneath" Qt was misbehaving.
- Make sure Visual Studio has access to Qt framework debug symbols and source code, and step through