Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QDeclarativeView + QGLWidget . BackBuffer updating incorrectly.
I'm QDeclarativeView and setting a QGLWidget as the viewport, which you can see the example of below.
My problem is that the viewport is not being cleared before the next frame is drawn, thus each successive frame is drawn on top of the last (frames accumulate). Normally OpenGL would swap buffers, clear the buffer, and draw the new frame.
Has anyone seen this problem?
Also, if someone knows how to get the viewport to be completely transparent when using a QGLWidget as a background that would be great to know too.
@//in the initializer list... creating a declarativeview called m_pathViewWidget
QGLFormat fmt = QGLFormat::defaultFormat();
QGLWidget* glWidget = new QGLWidget(fmt);
ZapB last edited by
Try adding a call to:
m_pathViewWidget->setViewportUpdateMode( QGraphicsView::FullViewportUpdate );
that tells the QGraphicsView (QDeclarativeView) that the viewport does not support partial updates and so should be cleared every frame.
Does that fix it for you?
I'll have to double check my results. I ran across an example with that and tried it.
With or without it I believe I was seeing the same behavior but only in the following instance:
In my QML file I would specify the main rectangle with a color of "#00ffffff" (that is, transparent). This would work fine when not using a QGLWidget as a viewport.
When I use a QGLWidget as a viewport the DeclarativeView background is entirely black (the widget), the rectangle (main QML item) background does, in fact, become transparent. However, anything which is rendered is accumulated on the screen as described above. It is almost as if it stops swapping buffers.
I should also mention I'm not knowingly using any QGraphicsView objects, although I have tried that call as I said.
I'm going to mark this as solved.
The problem only surfaced on the ARM processor I'm working with. On the desktop the problem did not show itself.
I moved to a QtQuick application from my QML / Qt hybrid and the screen is updated correctly in the embedded environment.