Fix compilation when Qt is built for GLES platforms
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Tue, 9 Jun 2020 15:11:12 +0000 (17:11 +0200)
committerAnton Gladky <gladk@debian.org>
Sun, 28 Nov 2021 22:34:47 +0000 (22:34 +0000)
On GLES 2.0/3.0 platforms (more specifically, for Qt5 "opengl es2" builds),
QOpenGLFunctions_3_2_Core does not exist.

After the last restructuring, from the GL 3.2 Core functions only
glDrawBuffer is used. glDrawBuffer can be trivially replaced with
glDrawBuffers, which is part of OpenGL 2.0 and GLES 3.0, and as an
extension in many GLES 2.0 implementations.

Gbp-Pq: Name 82_allow_gles_platforms.patch

GUISupport/Qt/QVTKRenderWindowAdapter.cxx

index 5a66e236df37ecdf0a49f5318ca6f7a71a5c2ff3..530cec9b2a5be576afb60aed7666a10b232d278c 100644 (file)
@@ -28,9 +28,8 @@
 #include <QOffscreenSurface>
 #include <QOpenGLContext>
 #include <QOpenGLDebugLogger>
+#include <QOpenGLExtraFunctions>
 #include <QOpenGLFramebufferObject>
-#include <QOpenGLFunctions>
-#include <QOpenGLFunctions_3_2_Core>
 #include <QPointer>
 #include <QScopedValueRollback>
 #include <QScreen>
@@ -334,14 +333,15 @@ public:
     {
       return false;
     }
-    QOpenGLFunctions_3_2_Core* f = this->Context->versionFunctions<QOpenGLFunctions_3_2_Core>();
+    QOpenGLExtraFunctions* f = this->Context->extraFunctions();
     if (!f)
     {
       return false;
     }
 
     f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targetId);
-    f->glDrawBuffer(targetAttachment);
+    const GLenum bufs[1] = { static_cast<GLenum>(targetAttachment) };
+    f->glDrawBuffers(1, bufs);
 
     f->glBindFramebuffer(GL_READ_FRAMEBUFFER, this->FBO->handle());
     f->glReadBuffer(
@@ -436,7 +436,7 @@ public:
   {
     Q_ASSERT(this->Context && this->FBO);
 
-    QOpenGLFunctions_3_2_Core* f = this->Context->versionFunctions<QOpenGLFunctions_3_2_Core>();
+    QOpenGLFunctions* f = this->Context->functions();
     if (f)
     {
       // now clear alpha otherwise we end up blending the rendering with