PDA

View Full Version : Isolating update of a single item



sp
5th August 2013, 07:40
Hi,
I have a QGraphicsScene in which there are many layers ( QGraphicsRectItem of same size). I have to update some layers at 10ms while others i have to update occasionally. All layers are visible. Is it possible to update single layer without updating other visible layer? (Application slows down drastically :( :(

One more thing. Is it possible to divide all layers into 3 different QGLFrameBufferObjects (I dont know much about QGLFrameBufferObject but somebody in my office has suggested that) to achieve above objective?

ChrisW67
5th August 2013, 07:59
What do you mean by "update"?

wysota
5th August 2013, 08:24
I have a QGraphicsScene in which there are many layers ( QGraphicsRectItem of same size). I have to update some layers at 10ms while others i have to update occasionally. All layers are visible. Is it possible to update single layer without updating other visible layer? (Application slows down drastically :( :(
You can enable caching for your items.


One more thing. Is it possible to divide all layers into 3 different QGLFrameBufferObjects (I dont know much about QGLFrameBufferObject but somebody in my office has suggested that) to achieve above objective?
It is possible but it won't help with anything.

sp
5th August 2013, 10:54
Update means calling update() function of graphicsItem every 10 ms.

Can u plz tell how to enable caching?

wysota
5th August 2013, 11:04
Through one of methods from the API that has "cache" in its name.

sp
8th August 2013, 06:51
tried but didnt work out. Application still slows down.

Can u plz tell how to use QFrameBufferObject inside paint() of QgraphicsItem.

In my application, there is a widget having a QGraphicsScene and a QGraphicsView.
In QGraphicsScene, there are many QGraphicsRectItem. Each QGraphicsRectItem has a QGraphicsItem.
I have set my QGraphicsView viewport as new QGLWidget.

As told earlier, items have different update rate. Any other way of isolating update???

wysota
8th August 2013, 08:09
tried but didnt work out. Application still slows down.
Apparently the problem is elsewhere.


Can u plz tell how to use QFrameBufferObject inside paint() of QgraphicsItem.
Exactly the same way you'd use it outside paint() -- you bind the FBO to the current GL context, render whatever you have to render and then unbind and use the result however you want.


As told earlier, items have different update rate. Any other way of isolating update???
For a GL viewport the whole viewport is always redrawn thus caching is the only thing that prevents all items to be repainted. If caching didn't help, then the only solution I can see is to not update the scene that often.