GPU usage shooting up when using OpenGL
-
I have a desktop application designed in Qt 5.14.2. It has 3D components inside it which are designed in ThreeJS. Now whenever i run my application even before the 3d components are loaded, my QT application is using around 18% GPU , while if i run it on a 4K monitor it shoots upto 40%. I have checked the part of code where ThreejS is rendering their objects but that part of the code releases the GPU after it is done rendering . My QT application continuously uses around 18-20% GPU and this becomes 0% only when application is minimized.
I am trying hard to figure out how to minimise this GPU usage or atleast identify piece of code which is causing this GPU load.
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);#if (defined (Q_OS_WIN32)) QApplication::setAttribute(Qt::AA_UseOpenGLES); #endif
the above part is the only part of my Qt project where OPenGL is mentioned.
Any help to maybe solve or atleast give some ideas for debugging will be really appreciated
-
@supratik123
There are many possible causes for high GPU usage in an OpenGL Qt application. Some of the most common causes are:The application uses many textures or shaders that need to be processed on the GPU.
The application uses many 3D models or polygons that need to be rendered on the GPU.
The application uses many effects such as lighting or shadows that need to be calculated on the GPU.
The application uses many animations or movements that need to be calculated on the GPU.
However, there are many other possible causes for high GPU usage. To fix the problem, you can try:Reduce the number of textures or shaders in your application.
Reduce the number of 3D models or polygons in your application.
Reduce the number of effects such as lighting or shadows in your application.
Reduce the number of animations or movements in your application.
You can also try running your application on a different computer or graphics card to see if the problem persists.The part of your code you showed so far, doesn't tell us much.
-
@J-Hilk I have tried this application in other systems and the issue remains. The thing is I am using qt only for wrapping up a web application i.e QT is only providing the framework for supporting it in desktop and providing the basic save, open project dialogs. We are not using it to provide shaders and textrues. We use OpenGL for hardware accelaraion.
Is DekstopGL the default implementation in windows if we dont mention anything and use QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);