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. How to update gui and render to opengl simultaneously without stutter
Forum Updated to NodeBB v4.3 + New Features

How to update gui and render to opengl simultaneously without stutter

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 125 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.
  • W Offline
    W Offline
    wakiki
    wrote on 1 Jul 2024, 18:33 last edited by wakiki 7 Jan 2024, 18:42
    #1

    In my app i get information from different worker threads via signal-slot and write them in my widgets every 500ms:

    m_timer->setInterval(500);
    QObject::connect(m_timer, &QTimer::timeout, this, &SystemManager::update);
    
    void SystemManager::update()
    {
        m_tabWidget->process(); //update gui such as QLineSeries::replace or QTableWidgetItem::setText
    }
    

    In an additional window i have a QOpenGLWindow running (i also tried with QOpenGlWidget with same results), which renders animated objects in ~120fps.

    GlWindow::GlWindow(QWidget *parent) : QOpenGLWindow()
    {
        QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
        QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
        QSurfaceFormat format;// = QSurfaceFormat::defaultFormat();
        format.setSwapInterval(0); //vsync on = 1, vsync off = 0
        ...
        QObject::connect(m_repaintTimer, SIGNAL(timeout()), this, SLOT(update()));
    }
    
    void GlWindow::initializeGL()
    {
        initializeOpenGLFunctions();
        ...
        const double targetFrametime = 1000.0 / 120.0; //1000.0 / 120.0;
        m_repaintTimer->start(targetFrametime);
    }
    

    Everytime when gui gets updated i see a small stutter inside of my opengl window. QLineSeries updates seem to have a bigger effect, but even with a few QTableWidget changes i can see a small interupt in the rendering.

    How do you normally update gui and opengl rendering at the same time?
    Is there a way to the tell the gui it can render before or after opengl render frame is finished?

    1 Reply Last reply
    0

    1/1

    1 Jul 2024, 18:33

    • Login

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