Re: [Interest] Performance of QGraphics[View Scene] changes with zoom
On Friday 20 May 2016 07:14:15 Uwe Rathmann wrote: > On Wed, 18 May 2016 15:57:04 -0300, Lisandro Damián Nicanor Pérez Meyer > > wrote: > > Now if I add a lot of straight lines (QGraphicsLineItem instances) > > performance (number of movements seen on screen per second) varies > > according the zoom. If I zoom in I get to a point in which everything is > > too slow. > > Qt does the polygon clipping very late, so a huge amount of pointless > caclulations is going on before it detects that it is not needed. IIRC > the Graphics View framework isn't any better than QPainter - but I havn't > checked the code quite some time. > > If this is still the case you need to implement your own polygon clipping > before entering Qt rendering code. > > At least this is what I do it in the Qwt project ( qwt.sf.net ). If you > need an implementation for polygon clipping you find something there too: > see https://sourceforge.net/p/qwt/code/HEAD/tree/trunk/qwt/src/ > qwt_clipper.cpp That sound svery plausible indeed! For now I switched to staright lines and "works for the moment", but if I need to speed up things or go back to other kind of lines I'll surely give it a look. Thanks a lot!! -- If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas. George Bernard Shaw Lisandro Damián Nicanor Pérez Meyer http://perezmeyer.com.ar/ http://perezmeyer.blogspot.com/ signature.asc Description: This is a digitally signed message part. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Performance of QGraphics[View Scene] changes with zoom
On Wed, 18 May 2016 15:57:04 -0300, Lisandro Damián Nicanor Pérez Meyer wrote: > Now if I add a lot of straight lines (QGraphicsLineItem instances) > performance (number of movements seen on screen per second) varies > according the zoom. If I zoom in I get to a point in which everything is > too slow. Qt does the polygon clipping very late, so a huge amount of pointless caclulations is going on before it detects that it is not needed. IIRC the Graphics View framework isn't any better than QPainter - but I havn't checked the code quite some time. If this is still the case you need to implement your own polygon clipping before entering Qt rendering code. At least this is what I do it in the Qwt project ( qwt.sf.net ). If you need an implementation for polygon clipping you find something there too: see https://sourceforge.net/p/qwt/code/HEAD/tree/trunk/qwt/src/ qwt_clipper.cpp HTH, Uwe ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] Performance of QGraphics[View Scene] changes with zoom
On 18 May 2016 at 15:57, Lisandro Damián Nicanor Pérezwrote: > Before I try to code a stripped-down version of my issue I would like to > describe it in case I'm missing something obvious. > > I have an app with a QGraphicsScene that holds a vehicle which is constantly > moving at a fixed rate (~10 times per second). Every time it moves it draws > some polygons behind (the path it went trough). Up to that point, everything > is ok. > > Now if I add a lot of straight lines (QGraphicsLineItem instances) performance > (number of movements seen on screen per second) varies according the zoom. If > I zoom in I get to a point in which everything is too slow. If I zoom out > things go back to normal. Note that once the lines are generated they are not > changed in any way. > > I understand that performance might decrease if those lines are near 45º due > to bounding boxes, but I fail to understand why it varies with zoom. I minimized my code to simple lines and drawing the bounding box of the vehicle, and found out that the problems starts if I use anything different than Qt::SolidLine for drawing the lines. As soon as I zoom out enough (the transformation matrix becoming 0.1*Identity) the problem "goes away", so I suspect a rasterization issue. -- Lisandro Damián Nicanor Pérez Meyer http://perezmeyer.com.ar/ http://perezmeyer.blogspot.com/ ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] Performance of QGraphics[View Scene] changes with zoom
Before I try to code a stripped-down version of my issue I would like to describe it in case I'm missing something obvious. I have an app with a QGraphicsScene that holds a vehicle which is constantly moving at a fixed rate (~10 times per second). Every time it moves it draws some polygons behind (the path it went trough). Up to that point, everything is ok. Now if I add a lot of straight lines (QGraphicsLineItem instances) performance (number of movements seen on screen per second) varies according the zoom. If I zoom in I get to a point in which everything is too slow. If I zoom out things go back to normal. Note that once the lines are generated they are not changed in any way. I understand that performance might decrease if those lines are near 45º due to bounding boxes, but I fail to understand why it varies with zoom. I'm using Qt 5.5 on Linux. Thanks in advance, Lisandro. -- Lisandro Damián Nicanor Pérez Meyer http://perezmeyer.com.ar/ http://perezmeyer.blogspot.com/ signature.asc Description: This is a digitally signed message part. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest