Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. GPU usage shooting up when using OpenGL
Forum Updated to NodeBB v4.3 + New Features

GPU usage shooting up when using OpenGL

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 359 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    supratik123
    wrote on 5 Apr 2023, 07:35 last edited by
    #1

    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

    J 1 Reply Last reply 5 Apr 2023, 07:46
    0
    • S supratik123
      5 Apr 2023, 07:35

      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

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 5 Apr 2023, 07:46 last edited by
      #2

      @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.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      S 1 Reply Last reply 5 Apr 2023, 08:06
      0
      • J J.Hilk
        5 Apr 2023, 07:46

        @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.

        S Offline
        S Offline
        supratik123
        wrote on 5 Apr 2023, 08:06 last edited by
        #3

        @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);

        1 Reply Last reply
        0

        1/3

        5 Apr 2023, 07:35

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved