PDA

View Full Version : Multiple QGLWidgets slow performance



seesomi
15th February 2013, 06:42
Hi All,
My application has a bunch of frames with each frame having 3 to 4 QGLWidgets.
Based on some user action I show a specific frame. No more
than 4 QGLWidgets are visible any any point of time, though the number of
QGLWIdgets is around 100.

The problem is the renderers are very unresponsive. I created a test application to debug this.
Refer to the attached screenshot TestQtQLWidget.jpg
The code creates 36 frames with a QGLWIdget inside each frame. Each button
is linked to a frame. Click on a button would maximize a specific frame.
Clicking on "show all frames" will show all frames. Each frame a slightly different
color .

When I maximize the window and start clicking on buttons, after clicking about
20 to 30 times the application becomes very slow and unresponsive.
Also when you click on "show all frames" the response is slow. White
background artifacts can also be seen sometimes.

I have attached the code, it can also be downloaded from git://github.com/seesomi/DebugBugs.git

I have the following questions:
a) Is it ok to have so many QGLWidgets in a QT application ?
b) How can I make the show/hide frame rendering smoother and not jerky as it is now
c) Is this related to having so many GL contexts or gl context switching, if so would sharing GL contexts across multiple widgets help...
d) Any other suggestions for improvement

Thanks,
Somesh

wysota
15th February 2013, 10:20
When I maximize the window and start clicking on buttons, after clicking about
20 to 30 times the application becomes very slow and unresponsive.
Also when you click on "show all frames" the response is slow. White
background artifacts can also be seen sometimes.
I cannot reproduce that on my system.


a) Is it ok to have so many QGLWidgets in a QT application ?
Well... you'd have to ask Apple as QT is their technology but if you ask about Qt then yes :) A different question is whether it makes sense or not.


b) How can I make the show/hide frame rendering smoother and not jerky as it is now
I would probably resign from using layouts in this case. Then I would first show the one frame you want to maximize and then when it is already shown I would gradually start hiding others returning to the event loop now and then to keep the ui responsive.


c) Is this related to having so many GL contexts or gl context switching, if so would sharing GL contexts across multiple widgets help...
I'm unable to answer this question. If you notice the app slowing down over time then I'd suspect some memory leak but I don't see where this leak would occur (in the GL driver maybe?)