PDA

View Full Version : Rendering 3D Objects on Ubuntu



Sandip
19th January 2009, 07:54
Hi,

I tried to show 3D objects in Graphics View framework.
I know it is not written to show 3D objects but I have to do it.

I have inherited my class from QGLWidget and QGraphicsItem and added this item into scene.

By doing a trick I am able to show object in the scene.
But getting following warnings on console.

How can I get override of it?

QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::restore: Painter not active
QPainter::restore: Painter not active
QPainter::save: Painter not active
QPainter::restore: Painter not active
QPainter::end: Painter not active, aborted
QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent
QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::end: Painter not active, aborted
QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent
QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent

Please help.

Thanks in advance.
Sandip

wysota
19th January 2009, 08:34
Showing us some code could be helpful. In short you are painting in a wrong place.

Sandip
19th January 2009, 09:28
Hi,
Please find attached zip file for source code.
It will be a great help for me if you can figure out why it is showing those warnings.

Thanks a lot!
Sandip

wysota
19th January 2009, 14:29
You can't inherit from both QGraphicsItem and a widget, it doesn't make any sense. And you are not using a single feature of QGraphicsView, so why use it at all? Embedding a QGLWidget inside a QGLWidget doesn't make much sense either - have a single QGLWidget and in its paintGL() routine call your items' painting routine. Currently you have two different painting routines in each item - one from Graphics View and one from QGLWidget.