[vlc-devel] [PATCH 1/4] doc: QtGl: fix usage of OpenGL functions when running in Qt

Steve Lhomme robux4 at ycbcr.xyz
Fri Feb 26 15:17:52 UTC 2021


glActiveTexture doesn't exist in opengl32.dll on Windows.

Co-Authored-By: Alexandre Janniaux <ajanni at videolabs.io>
---
 doc/libvlc/QtGL/qtvlcwidget.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index d1ff858af84..c16fb335091 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -340,15 +340,16 @@ void QtVLCWidget::initializeGL()
 
 void QtVLCWidget::paintGL()
 {
+    QOpenGLFunctions *GL = context()->functions();
     QOpenGLFramebufferObject *fbo = mVLC->getVideoFrame();
-    if (fbo != NULL)
+    if (fbo != NULL && GL != NULL)
     {
         m_program->bind();
 
-        glClearColor(1.0, 0.5, 0.0, 1.0);
+        GL->glClearColor(1.0, 0.5, 0.0, 1.0);
 
-        glActiveTexture(GL_TEXTURE0);
-        glBindTexture(GL_TEXTURE_2D, fbo->takeTexture());
+        GL->glActiveTexture(GL_TEXTURE0);
+        GL->glBindTexture(GL_TEXTURE_2D, fbo->takeTexture());
 
         vertexBuffer.bind();
         m_program->setAttributeArray("position", (const QVector2D *)nullptr, sizeof(GLfloat)*2);
@@ -357,7 +358,7 @@ void QtVLCWidget::paintGL()
         m_program->enableAttributeArray("position");
 
         vertexIndexBuffer.bind();
-        glDrawElements(
+        GL->glDrawElements(
             GL_TRIANGLE_STRIP,  /* mode */
             4,                  /* count */
             GL_UNSIGNED_SHORT,  /* type */
-- 
2.29.2



More information about the vlc-devel mailing list