[vlc-commits] doc: QtGl: check OpenGLES with OpenGL too

Alexandre Janniaux git at videolan.org
Thu Nov 12 15:47:56 CET 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Mon Nov  9 16:35:14 2020 +0100| [69854d2454a78dcee4494f5595ccec564e5c5e2e] | committer: Alexandre Janniaux

doc: QtGl: check OpenGLES with OpenGL too

We might be running OpenGLES, and thus need libvlc_video_engine_gles2
instead of the OpenGL one.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=69854d2454a78dcee4494f5595ccec564e5c5e2e
---

 doc/libvlc/QtGL/qtvlcwidget.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index c45324e106..761c6d7cf1 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -48,6 +48,13 @@ public:
         cleanup(this);
     }
 
+    /// return whether we are using OpenGLES or OpenGL, which is needed to know
+    /// whether we use the libvlc OpenGLES2 engine or the OpenGL one
+    bool isOpenGLES()
+    {
+        return mContext->isOpenGLES();
+    }
+
     /// return the texture to be displayed
     QOpenGLFramebufferObject *getVideoFrame()
     {
@@ -198,7 +205,8 @@ bool QtVLCWidget::playMedia(const char* url)
     }
 
     // Define the opengl rendering callbacks
-    libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
+    libvlc_video_set_output_callbacks(m_mp,
+        mVLC->isOpenGLES() ? libvlc_video_engine_gles2 : libvlc_video_engine_opengl,
         VLCVideo::setup, VLCVideo::cleanup, nullptr, VLCVideo::resizeRenderTextures, VLCVideo::swap,
         VLCVideo::make_current, VLCVideo::get_proc_address, nullptr, nullptr,
         mVLC);



More information about the vlc-commits mailing list