PDA

View Full Version : OpenGL in QGraphicsItem not getting the correct PaintEngine



erila107
23rd January 2011, 07:39
Hi everyone

I have a QGraphicsView with a QGraphicsScene. I've added a QGLWidget as viewport to the QGraphicsView and implemented ad OpenGL based drawBackground in QGraphicsScene.

The background add a polygon with a texture on i as background.

The problem starts when adding items.

I've derived some classes from QGraphpicsItem and re-implemented the paint function. When I test which paintEngine that is pressent it is NOT a OpenGL or OpenGL2.

But I can draw the lines (and other stuff) in the item over the scene-background. But the problem is that the texture from the background of the scene is drawn in the items boundRect.

I don't know if the problem with the wrong paintEngine is related to the drawing problem.
THe image below shows the problem The bottom-left corner displays a miniversion of the GLGraphicsScene background texture. The other three items are correctly rendered.

http://www.ortogonal.com/glbackground.png

Best regards
Erik

SteveQt
9th April 2015, 14:53
Hi,
I know this post is very old but I am developing a Qt application and I have exactly the same problem :). Did you solve it?
Thanks.