Qt6 topics merged with General

How to use QGLPixelBuffer or QGLFramebufferObject in QGraphicsItem paint

  • As we know in QGraphicsScene and QGraphicsView, there are many QGraphicsItems. in the MyQGraphicsItem::paint(QPainter *pxPainter, const QStyleOptionGraphicsItem *pxOption, QWidget *pxWidget) implement, we use the pxPainter to draw image(QImage) or PixelMap(QPixMap). when we set the graphicsView->setViewport(new QGLWidget), we use the OpenGL paintEngine, but we can not use the QGLPixelBuffer or QGLFramebufferObject being the paintDevice. Is there any solution to support? for the QGLFramebufferObject is more efficient as described.

  • me have some similar problem

    Why QGLFramebufferObject in QGraphicsItem don’t work?

  • Thanks for your referance, so we just ignore the pxPainter in the parameters and paint ourselves.

    Another issue is how to handle the zOrder of the GraphicsItems, or some composition of images.

    I'v tried bindTexture to the QGLFramebufferObject, seems not work.

Log in to reply