How to open multiple windows without decreasing framerate
-
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!
-
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-openglHowever, if this is useful to you or how to do it in Qt, i cant say.
-
@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-openglHowever, 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.