[packages/pcl] - one more vtk 7.x fix

baggins baggins at pld-linux.org
Thu Jan 26 08:44:43 CET 2017


commit 2b7743ff9570fc5800324bea394ab73ccc9d5b7f
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Thu Jan 26 08:44:21 2017 +0100

    - one more vtk 7.x fix

 pcl.spec         |  2 ++
 vtkOpenGL2.patch | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
---
diff --git a/pcl.spec b/pcl.spec
index ce1495e..fcc40ba 100644
--- a/pcl.spec
+++ b/pcl.spec
@@ -23,6 +23,7 @@ Patch2:		%{name}-openni.patch
 Patch3:		eigen-dependency.patch
 Patch4:		vtk7.patch
 Patch5:		vtk71.patch
+Patch6:		vtkOpenGL2.patch
 URL:		http://pointclouds.org/
 BuildRequires:	OpenGL-devel
 BuildRequires:	OpenGL-GLU-devel
@@ -116,6 +117,7 @@ Dokumentacja API oraz wprowadzenie do biblioteki PCL.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %build
 mkdir build
diff --git a/vtkOpenGL2.patch b/vtkOpenGL2.patch
new file mode 100644
index 0000000..21a2ead
--- /dev/null
+++ b/vtkOpenGL2.patch
@@ -0,0 +1,65 @@
+From 9cfb00970f7d46f1732149d4c50ba3646f038b6c Mon Sep 17 00:00:00 2001
+From: Sergey Alexandrov <alexandrov88 at gmail.com>
+Date: Thu, 11 Feb 2016 22:19:01 +0100
+Subject: [PATCH] Use vtkTextureUnitManager to query the number of available
+ texture units
+
+The new OpenGL2 backend does not have vktOpenGLHardwareSupport class
+which was used before.
+---
+ visualization/src/pcl_visualizer.cpp | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp
+index dc91674..007c251 100644
+--- a/visualization/src/pcl_visualizer.cpp
++++ b/visualization/src/pcl_visualizer.cpp
+@@ -84,7 +84,6 @@
+ #include <vtkRenderWindowInteractor.h>
+ #include <vtkAreaPicker.h>
+ #include <vtkXYPlotActor.h>
+-#include <vtkOpenGLHardwareSupport.h>
+ #include <vtkOpenGLRenderWindow.h>
+ #include <vtkJPEGReader.h>
+ #include <vtkBMPReader.h>
+@@ -92,6 +91,7 @@
+ #include <vtkPNMReader.h>
+ #include <vtkPNGReader.h>
+ #include <vtkTIFFReader.h>
++#include <vtkTextureUnitManager.h>
+ 
+ #include <pcl/visualization/common/shapes.h>
+ #include <pcl/visualization/pcl_visualizer.h>
+@@ -3223,17 +3223,18 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh,
+ #endif
+ 
+   vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New ();
+-  vtkOpenGLHardwareSupport* hardware = vtkOpenGLRenderWindow::SafeDownCast (win_)->GetHardwareSupport ();
++  vtkTextureUnitManager* tex_manager = vtkOpenGLRenderWindow::SafeDownCast (win_)->GetTextureUnitManager ();
++  if (!tex_manager)
++    return (false);
+-  bool supported = hardware->GetSupportsMultiTexturing ();
+   // Check if hardware support multi texture
+-  std::size_t texture_units (hardware->GetNumberOfFixedTextureUnits ());
+-  if ((mesh.tex_materials.size () > 1) && supported && (texture_units > 1))
++  int texture_units = tex_manager->GetNumberOfTextureUnits ();
++  if ((mesh.tex_materials.size () > 1) && (texture_units > 1))
+   {
+     if (texture_units < mesh.tex_materials.size ())
+       PCL_WARN ("[PCLVisualizer::addTextureMesh] GPU texture units %d < mesh textures %d!\n",
+                 texture_units, mesh.tex_materials.size ());
+     // Load textures
+-    std::size_t last_tex_id = std::min (mesh.tex_materials.size (), texture_units);
++    std::size_t last_tex_id = std::min (static_cast<int> (mesh.tex_materials.size ()), texture_units);
+     int tu = vtkProperty::VTK_TEXTURE_UNIT_0;
+     std::size_t tex_id = 0;
+     while (tex_id < last_tex_id)
+@@ -3279,7 +3278,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh,
+   } // end of multi texturing
+   else
+   {
+-    if (!supported || texture_units < 2)
++    if ((mesh.tex_materials.size () > 1) && (texture_units < 2))
+       PCL_WARN ("[PCLVisualizer::addTextureMesh] Your GPU doesn't support multi texturing. "
+                 "Will use first one only!\n");
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pcl.git/commitdiff/2b7743ff9570fc5800324bea394ab73ccc9d5b7f



More information about the pld-cvs-commit mailing list