PDA

View Full Version : QGraphicsScene performance



Aceman2000
1st June 2008, 19:25
I have a QGraphicsScene with some items that inherit QGraphicsPixmapItem, and change their displayed pixmap at the advance() function.

Even though QGraphicsScene is supposed to have a very good performance with a million items, 20*15 of my items at size 32px*32px at 25 fps generates 95% CPU usage (CPU is an AMD Athlon XP 2200+). 40*30 if these items with 16px*16px size make 100% CPU usage, and lag.

What should I do to have reasonable performance? :confused:

pherthyl
1st June 2008, 23:37
Need more detail. How are you changing the displayed pixmaps? Are the pixmaps cached? 300 pixmaps changing at 25FPS is 7500 pixmaps to load per second. That's a lot if they're all different.

wysota
2nd June 2008, 07:19
Cache, cache, cache and turn off bsp tree indexing if your items are moving or changing their boundingRect.

Aceman2000
2nd June 2008, 08:10
All pixmaps are stored in a QList<QPixmap>, and are preloaded.

Brandybuck
2nd June 2008, 18:10
Rendering pixmaps is slow work. If you do any sort of transforms, it's worse. You might try using an OpenGL engine for Graphics View. My webcast on Graphics View (ICS Network) has some other tips.