SHA256
1
0
forked from pool/vtk
vtk/0001-Allow-compilation-on-GLES-platforms.patch
Stefan Brüns 6775ff2422 Accepting request 821682 from home:StefanBruens:branches:science
- Update to version 9.0.1:
  * Drop obsolete patches:
    + bundled_exodusii_add_missing_libpthread.patch
    + vtk-parallelgeometry-dependency.patch
    + vtk-qt-5.15-include-QPainterPath.patch
- Explicitly enable module RenderingContextOpenGL2 required for PCL
- Conditionally add pugixml-devel Requires in devel package
- Make devel package installable even when built without Java
- Remove CAPITALIZATION from comments
- Drop obsolete TK build dependency
- Drop unused wget build dependency
- Wrap devel-doc generation in bcond (keep defaulted to off), and
  drop the essentially empty package when disabled.
- Fix build on ARM/Qt GLES (boo#1172723):
  * set VTK_OPENGL_USE_GLES
  * Add 0001-clean-up-some-old-opengl-es-stuff.patch
  * Add 0001-Remove-duplicate-check-for-QOpenGLFunctions_3_2_Core.patch
  * Rebase 0001-Allow-compilation-on-GLES-platforms.patch
  * Add 0001-Replace-last-glDrawBuffer-call-with-glDrawBuffers-1.patch
  * Add 0001-Use-2D-textures-for-1D-texture-emulation-on-GLES.patch
  * Add 0001-Add-missing-guard-required-for-GLES-to-disable-stere.patch
  * Add 0001-Correct-GL_BACK-GL_BACK_LEFT-mapping-on-GLES.patch
  * Add 0002-Use-GL_DRAW_BUFFER0-instead-of-GL_DRAW_BUFFER-for-GL.patch
  * Add 0001-GL_POINT_SPRITE-is-only-available-for-Compatibility-.patch
  * Add 0002-Guard-GL_LINE_SMOOTH-for-GLES.patch
  * Add 0001-Guard-glPointSize-with-GL_ES_VERSION_3_0.patch
- Add 0001-Fix-PyVTKAddFile_-function-signature-mismatch.patch
- Add 0001-Replace-invalid-GL_LINE-with-GL_LINES-for-glDrawArra.patch

OBS-URL: https://build.opensuse.org/request/show/821682
OBS-URL: https://build.opensuse.org/package/show/science/vtk?expand=0&rev=164
2020-07-18 22:18:35 +00:00

76 lines
3.0 KiB
Diff

From 5c4e4e5832613e758b7c1389a5dbcc1d57db7c6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 9 Jun 2020 17:11:12 +0200
Subject: [PATCH] Allow compilation on GLES platforms
On GLES 2.0 platforms (more specifically, for Qt5 "opengl es2" builds),
QOpenGLFunctions_3_2_Core does not exist. Since Qt 5.7,
QOpenGlFramebufferObject has a static wrapper method for framebuffer
blitting, which in worst case (i.e. no GL_EXT_framebuffer blit
extension) is a noop, but handles all GL platform differences otherwise
(3.2 Core context, GLES 3.0, or any earlier with required extensions).
The code ignores the passed in targetId FBO handle, but relies on
the default framebuffer object of the context. As the calling code calls
QOpenGLWindow::makeCurrent() the context default FBO is the one returned
by QOpenGLWindow::defaultFramebufferObject().
---
GUISupport/Qt/QVTKRenderWindowAdapter.cxx | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/GUISupport/Qt/QVTKRenderWindowAdapter.cxx b/GUISupport/Qt/QVTKRenderWindowAdapter.cxx
index 5a66e236df..e5fc5a6135 100644
--- a/GUISupport/Qt/QVTKRenderWindowAdapter.cxx
+++ b/GUISupport/Qt/QVTKRenderWindowAdapter.cxx
@@ -334,12 +334,17 @@ public:
{
return false;
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
QOpenGLFunctions_3_2_Core* f = this->Context->versionFunctions<QOpenGLFunctions_3_2_Core>();
+#else
+ QOpenGLFunctions* f = this->Context->functions();
+#endif
if (!f)
{
return false;
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
f->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, targetId);
f->glDrawBuffer(targetAttachment);
@@ -358,6 +363,20 @@ public:
auto sourceSize = this->FBO->size();
f->glBlitFramebuffer(0, 0, sourceSize.width(), sourceSize.height(), targetRect.x(),
targetRect.y(), targetRect.width(), targetRect.height(), GL_COLOR_BUFFER_BIT, GL_NEAREST);
+#else
+ GLboolean scissorTest = f->glIsEnabled(GL_SCISSOR_TEST);
+ if (scissorTest == GL_TRUE)
+ {
+ f->glDisable(GL_SCISSOR_TEST); // Scissor affects glBindFramebuffer.
+ }
+ auto sourceSize = this->FBO->size();
+ QRect sourceRect(0, 0, sourceSize.width(), sourceSize.height());
+ unsigned int readAttachment =
+ left ? this->RenderWindow->GetFrontLeftBuffer() : this->RenderWindow->GetFrontRightBuffer();
+ QOpenGLFramebufferObject::blitFramebuffer(nullptr, targetRect, this->FBO.get(), sourceRect,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST, readAttachment, targetAttachment,
+ QOpenGLFramebufferObject::DontRestoreFramebufferBinding);
+#endif
this->clearAlpha(targetRect);
@@ -436,7 +455,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
--
2.27.0