Drawing 70k objects in QGraphicsView - lag lag lag
-
@Kent-Dorfman Hey, hardware wise 2990wx/2080super. As to generation, its just a loop for int x=0;x<100000;++x{}, I'm not even drawing the items. Just added to scene one time and then panning around in scene.
Its my attempt at uv editor :- ) So object count can go well over 1 mil + and so on.
-
@Dariusz
GraphicsView is single threaded and not hardware accelerated. That said, it's relatively efficient code, so adding 70k items might take a bit of time, but it should be doable.I don't see any code what kind of items you are trying to add. The problem might lie there.
The code you posted has little to do with GraphicsView per se, so the question is a bit unclear to me.
-
@Asperamanca Hey, The code I added is being executed in graphicsView, it configures it to use openGL for drawing instead of CPU.
The problem is not how long it takes to add items, but how well it performs once I added them. I'm using a base QGraphicsItem as my class and then extended that. In my extension I have disabled drawing so there is 0 drawing happening. Only items added to scene and qt run its own tests on them. As far as I can tell the drawing is not the issue, but just processing 70k items.
I'm looking in to building openGL app for this as it does not look like QGraphicsView is optimized for it.
Regards
Dariusz -
@Asperamanca said in Drawing 70k objects in QGraphicsView - lag lag lag:
@Dariusz
If you don't use any GraphicsView features, you probably should not use GraphicsView at all. Consider an alternative like Qt3d or QtQuick3Well I'm just trying to understand where the bottleneck is... I did drawing, I had 1 fps. So I disabled all paint functions to see if that help, that did help, but I'm still having issues... so I take graphicsView is not for very large scenes then ?
-
@Dariusz
Hi
I if take the 40000 sample
https://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html
and double the items so it creates 80.000, its still not lagging. -
Why would QGraphicsView go out of its way to slow down the OpenGL implementation? Are you using modern OpengGL techniques or the old interface which is slow and outdated? Are you using shaders? If no, then it probably isn't modern OpenGL. Without showing your code you are not helping yourself sort this out.
https://learnopengl.com/Offline-book
This book helped me. It is based on post 3.3 opengl if I remember right.Edit: Also, yes, it is possible Qt is not what you need, but I don't think Qt is inherently slow at OpenGL.