I am using QQuickControls 2 (SwipeView) with OpenSceneGraph for the 3d rendering. Using QQuickFramebufferObject for the integration.
Since I have introduced a SwipeView, I observe some flickering of my GUI.
I have looked for ages in the doc (it probably sums literally up to weeks) and have absolutely no idea why I have this flickering.
Here is a video of the faulty behavior (flickering starts at ~20s).
And here is my rendering code:
class OsgRenderer : public QQuickFramebufferObject::Renderer
{
public:
explicit OsgRenderer();
QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) LC_OVERRIDE;
void synchronize(QQuickFramebufferObject* item) LC_OVERRIDE;
void render() LC_OVERRIDE;
protected:
friend class OsgWindow;
OsgItem* m_osgItem;
};
void OsgRenderer::render()
{
assert(m_osgItem);
if ( !m_osgItem->getViewer() )
return;
// Without this line the model is not displayed in the second
// and subsequent frames.
QOpenGLContext::currentContext()->functions()->glUseProgram(0);
// Ask OSG to render.
m_osgItem->getViewer()->frame(); // WARNING: non-blocking (executed in a thread of its own - in a thread-safe way).
// Reset OpenGl state for QtQuick.
m_osgItem->window()->resetOpenGLState();
}
Any idea of where that can come from?