summaryrefslogtreecommitdiffstats
path: root/DOCS/client_api_examples/qml_direct/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'DOCS/client_api_examples/qml_direct/main.cpp')
-rw-r--r--DOCS/client_api_examples/qml_direct/main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/DOCS/client_api_examples/qml_direct/main.cpp b/DOCS/client_api_examples/qml_direct/main.cpp
index 5f1f1468cf..93a843dfd0 100644
--- a/DOCS/client_api_examples/qml_direct/main.cpp
+++ b/DOCS/client_api_examples/qml_direct/main.cpp
@@ -96,6 +96,8 @@ void MpvObject::handleWindowChanged(QQuickWindow *win)
this, &MpvObject::sync, Qt::DirectConnection);
connect(win, &QQuickWindow::sceneGraphInvalidated,
this, &MpvObject::cleanup, Qt::DirectConnection);
+ connect(win, &QQuickWindow::frameSwapped,
+ this, &MpvObject::swapped, Qt::DirectConnection);
win->setClearBeforeRendering(false);
}
@@ -110,6 +112,11 @@ void MpvObject::sync()
renderer->size = window()->size() * window()->devicePixelRatio();
}
+void MpvObject::swapped()
+{
+ mpv_opengl_cb_report_flip(mpv_gl, 0);
+}
+
void MpvObject::cleanup()
{
if (renderer) {