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. QOpenGLWidget cpu usage is abnormal

QOpenGLWidget cpu usage is abnormal

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 193 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.
  • Q Offline
    Q Offline
    Quiccz
    wrote on last edited by
    #1

    I am using QOpenGLWidget and have inherited paintGL, but there is no operation within paintGL. Then, I am using a timer to call update.

    class myWidget : public QOpenGLWidget
    {
    Q_OBJCET
    public:
      myWidget();
    public slots:
      void call_update();
    protect:
      void initializeGL() override;
      void paintGL() override;
    }
    
    void myWidget::paintGL()
    {
    // do nothing
    };
    
    void myWidget::call_update()
    {
      update();
    }
    
    myWidget w;
    QTimer* timer = new QTimer(nullptr);
    connect(timer, &QTimer::timeout, &w, &myWidget::call_update);
    //timer.start(16) //  10% cpu usage
    timer.start(17) // 0.5% cpu usage
    

    i know want to use vsync. so my timer need less then 16.6, but its cpu usage is abnormal

    1 Reply Last reply
    0

    • Login

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