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 open multiple windows without decreasing framerate
Forum Updated to NodeBB v4.3 + New Features

How to open multiple windows without decreasing framerate

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 512 Views 3 Watching
  • 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.
  • M Offline
    M Offline
    ManuelR
    wrote on 10 Jun 2019, 07:21 last edited by
    #1

    I've taken Qt "qopenglwidget" example, and tried to make each new widget open in a new window; however, with my solution the performance drops dramatically for each new window opened, (from 60 to 30 with the first window opened) so I was wondering what's the correct way of doing this without affecting the framerate that much.

    Here's the part of the code I changed:

    void MainWindow::addNew()
    {
        QOpenGLContext* main_context = m_glWidgets.first()->context();
        if (m_nextY == 4)
            return;
        GLWidget *w = new GLWidget(this, false, qRgb(qrand() % 256, qrand() % 256, qrand() % 256), main_context);
        m_glWidgets << w;
        connect(m_timer, SIGNAL(timeout()), w, SLOT(update()));
        //m_layout->addWidget(w, m_nextY, m_nextX, 1, 1);
        w->show();
        if (m_nextX == 3) {
            m_nextX = 1;
            ++m_nextY;
        } else {
            ++m_nextX;
        }
    }
    

    The original example is on "/Examples/Qt-5.5/opengl/qopenglwidget" for anyone wondering.

    Thanks!

    1 Reply Last reply
    1
    • M Offline
      M Offline
      ManuelR
      wrote on 20 Jun 2019, 11:57 last edited by
      #2

      Hi, I've been doing more tests with QT examples, trying out different things and still can't seem to open more than one window without affecting the framerate, if anyone can give me at least an insight on it I'd really appreciate it!

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 20 Jun 2019, 15:51 last edited by
        #3

        Hi
        This is just random thought. Im not openGL expert.
        However, i know from open source 3d editors i have befuddled that viewports are often used
        to have separate views of the scene.
        https://stackoverflow.com/questions/726379/how-to-use-multiple-viewports-in-opengl

        However, if this is useful to you or how to do it in Qt, i cant say.

        M 1 Reply Last reply 21 Jun 2019, 09:31
        0
        • M mrjj
          20 Jun 2019, 15:51

          Hi
          This is just random thought. Im not openGL expert.
          However, i know from open source 3d editors i have befuddled that viewports are often used
          to have separate views of the scene.
          https://stackoverflow.com/questions/726379/how-to-use-multiple-viewports-in-opengl

          However, if this is useful to you or how to do it in Qt, i cant say.

          M Offline
          M Offline
          ManuelR
          wrote on 21 Jun 2019, 09:31 last edited by
          #4

          @mrjj said in How to open multiple windows without decreasing framerate:

          Hi
          This is just random thought. Im not openGL expert.
          However, i know from open source 3d editors i have befuddled that viewports are often used
          to have separate views of the scene.
          https://stackoverflow.com/questions/726379/how-to-use-multiple-viewports-in-opengl

          However, if this is useful to you or how to do it in Qt, i cant say.

          Thanks for answering, unfortunately my issue is not with 3D rendering, I also did some tests with 2D content and even without rendering anything in some of the windows, and it seems like the problem is opening another system window.

          The qglwindow example I mention does render multiple 3D widgets into the same window using a layout without any significant performance impact, but in the very moment you try to make those widgets open their own system window performance tanks. As I mentioned opening just one more window makes the framerate fall to half.

          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