diff options
author | Benjamin Chrétien | 2016-02-19 00:13:24 +0900 |
---|---|---|
committer | Benjamin Chrétien | 2016-02-19 00:13:24 +0900 |
commit | a95dbffbded28df9b0a1a563703b8a6e69935f88 (patch) | |
tree | 93067ae4695729b3f6480ef5eab81a085fc27013 | |
parent | ec11dd9131d317186009f82ab30426ede376a1a8 (diff) | |
download | aur-a95dbffbded28df9b0a1a563703b8a6e69935f88.tar.gz |
Update for qt5 + fix for vtk7
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 91 | ||||
-rw-r--r-- | vtk7.patch | 360 |
3 files changed, 419 insertions, 46 deletions
@@ -1,12 +1,15 @@ +# Generated by mksrcinfo v8 +# Thu Feb 18 15:12:54 UTC 2016 pkgbase = pcl pkgdesc = A comprehensive open source library for n-D Point Clouds and 3D geometry processing - pkgver = 1.7.2 + pkgver = 1.8.0rc1 pkgrel = 1 url = http://www.pointclouds.org arch = x86_64 arch = i686 license = BSD makedepends = cmake + makedepends = gl2ps depends = boost depends = eigen depends = flann @@ -14,12 +17,15 @@ pkgbase = pcl depends = qhull depends = qt5-base depends = glu - optdepends = openmpi + depends = qt5-webkit + depends = openmpi optdepends = cuda optdepends = openni2 optdepends = python-sphinx - source = https://github.com/PointCloudLibrary/pcl/archive/pcl-1.7.2.tar.gz - md5sums = 02c72eb6760fcb1f2e359ad8871b9968 + source = https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0rc1.tar.gz + source = vtk7.patch + sha256sums = 18ff4519026a7885d2fd0ee1d06939a7755e83e082840e4929fb2883948e5142 + sha256sums = eaf5f90ded00d47ae8fbb34c3cc8878e694f44b684038a9c593c432035a0b2c1 pkgname = pcl @@ -1,64 +1,71 @@ -# Maintainer : Yuxin Wu <ppwwyyxxc@gmail.com> +# Maintainer: Benjamin Chrétien <chretien dot b plus aur at gmail dot com> +# Contributor: Yuxin Wu <ppwwyyxxc@gmail.com> # Contributor: Sven-Hendrik Haase <sh@lutzhaase.com> # Contributor: hauptmech # Contributor: figo.zhang # Contributor: lubosz pkgname=pcl -pkgver=1.7.2 +pkgver=1.8.0rc1 pkgrel=1 pkgdesc="A comprehensive open source library for n-D Point Clouds and 3D geometry processing" arch=('x86_64' 'i686') url='http://www.pointclouds.org' license=('BSD') -depends=('boost' 'eigen' 'flann' 'vtk' 'qhull' 'qt5-base' 'glu') -makedepends=('cmake') -optdepends=('openmpi' 'cuda' 'openni2' 'python-sphinx') -source=("https://github.com/PointCloudLibrary/pcl/archive/pcl-${pkgver}.tar.gz") -md5sums=('02c72eb6760fcb1f2e359ad8871b9968') +depends=('boost' 'eigen' 'flann' 'vtk' 'qhull' 'qt5-base' 'glu' 'qt5-webkit' 'openmpi') +makedepends=('cmake' 'gl2ps') +optdepends=('cuda' 'openni2' 'python-sphinx') +source=("https://github.com/PointCloudLibrary/pcl/archive/pcl-${pkgver}.tar.gz" + "vtk7.patch") +sha256sums=('18ff4519026a7885d2fd0ee1d06939a7755e83e082840e4929fb2883948e5142' + 'eaf5f90ded00d47ae8fbb34c3cc8878e694f44b684038a9c593c432035a0b2c1') -build() { - cd $srcdir/pcl-pcl-$pkgver +prepare() { + cd "${srcdir}/pcl-pcl-${pkgver}" - # Patch to support boost 1.5.6: - # 1. Api change. See http://www.pcl-users.org/PCL-compilation-errors-Please-help-me-td4035209.html - # This patch is not necessary for now. - # sed -i "s/boost::property_tree::xml_writer_settings.*/boost::property_tree::xml_writer_settings<std::string> settings = boost::property_tree::xml_writer_make_settings<std::string>('\\\t', 1);/g" io/src/lzf_image_io.cpp - # 2. Qt moc parser fails on some boost headers files. Try to get around. - grep -rl '#include <boost/date_time/posix_time/posix_time.hpp>' . \ - | xargs sed -i "s/#include <boost.*posix_time.hpp>/#ifndef Q_MOC_RUN\n\r#include <boost\\/date_time\\/posix_time\\/posix_time.hpp>\n\r#endif/g" + # Patch to support boost 1.5.6: + # 1. Api change. See http://www.pcl-users.org/PCL-compilation-errors-Please-help-me-td4035209.html + # This patch is not necessary for now. + # sed -i "s/boost::property_tree::xml_writer_settings.*/boost::property_tree::xml_writer_settings<std::string> settings = boost::property_tree::xml_writer_make_settings<std::string>('\\\t', 1);/g" io/src/lzf_image_io.cpp + # 2. Qt moc parser fails on some boost headers files. Try to get around. + grep -rl '#include <boost/date_time/posix_time/posix_time.hpp>' . \ + | xargs sed -i "s/#include <boost.*posix_time.hpp>/#ifndef Q_MOC_RUN\n\r#include <boost\\/date_time\\/posix_time\\/posix_time.hpp>\n\r#endif/g" - [[ -d build ]] && rm -r build - mkdir -p build && cd build + patch -p1 < ../vtk7.patch - # -DBUILD_gpu_people=OFF \ Disable until CUDA npp detection is fixed in cmake - cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DBUILD_apps=ON \ - -DBUILD_apps_cloud_composer=ON \ - -DBUILD_apps_in_hand_scanner=ON \ - -DBUILD_apps_modeler=ON \ - -DBUILD_apps_point_cloud_editor=ON \ - -DBUILD_examples=ON \ - -DBUILD_global_tests=OFF \ - -DBUILD_surface_on_nurbs=ON \ - -DBUILD_CUDA=ON \ - -DBUILD_cuda_io=ON \ - -DBUILD_cuda_apps=ON \ - -DBUILD_GPU=ON \ - -DBUILD_gpu_surface=ON \ - -DBUILD_gpu_tracking=ON \ - -DBUILD_app_3d_rec_framework=ON \ - -DBUILD_simulation=ON + # [[ -d build ]] && rm -r build + mkdir -p build && cd build - make + # -DBUILD_gpu_people=OFF \ Disable until CUDA npp detection is fixed in cmake + cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DBUILD_apps=ON \ + -DBUILD_apps_cloud_composer=OFF \ + -DBUILD_apps_in_hand_scanner=ON \ + -DBUILD_apps_modeler=ON \ + -DBUILD_apps_point_cloud_editor=OFF \ + -DBUILD_examples=ON \ + -DBUILD_global_tests=OFF \ + -DBUILD_surface_on_nurbs=ON \ + -DBUILD_CUDA=ON \ + -DBUILD_cuda_io=ON \ + -DBUILD_cuda_apps=ON \ + -DBUILD_GPU=ON \ + -DBUILD_gpu_surface=ON \ + -DBUILD_gpu_tracking=ON \ + -DBUILD_app_3d_rec_framework=ON \ + -DBUILD_simulation=ON } -package() { - cd $srcdir/pcl-pcl-$pkgver/build +build() { + cd "${srcdir}/pcl-pcl-${pkgver}/build" + make +} - make DESTDIR=$pkgdir install +package() { + cd "${srcdir}/pcl-pcl-${pkgver}/build" + make DESTDIR=${pkgdir} install install -Dm644 ../LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" } diff --git a/vtk7.patch b/vtk7.patch new file mode 100644 index 000000000000..2193b5661907 --- /dev/null +++ b/vtk7.patch @@ -0,0 +1,360 @@ +From 73e727825e80e99adbc64658443d58de70d5a787 Mon Sep 17 00:00:00 2001 +From: Sergey Alexandrov <alexandrov88@gmail.com> +Date: Thu, 11 Feb 2016 22:19:01 +0100 +Subject: Use vtkTextureUnitManager to query the number of available texture + units + +The new OpenGL2 backend does not have vktOpenGLHardwareSupport class +which was used before. + +Add CMake variable and C++ macro VTK_RENDERING_BACKEND_OPENGL_VERSION + +These can be used at configuration and compilation times to adjust for +the currently used backend. + +Conditionally compile code that uses vtkVertexBufferObjectMapper + +This mapper is a performance optimization that is only needed when +OpenGL backend is used. The modern OpenGL2 backend uses vertex buffer +objects transparently for us. + +Update documentation for setUseVbos() function + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 36fc4c9..e5fd763 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -361,7 +361,12 @@ option(WITH_VTK "Build VTK-Visualizations" TRUE) + if(WITH_VTK AND NOT ANDROID) + find_package(VTK) + if(VTK_FOUND) +- message(STATUS "VTK_MAJOR_VERSION ${VTK_MAJOR_VERSION}") ++ if(NOT DEFINED VTK_RENDERING_BACKEND) ++ # On old VTK versions this variable does not exist. In this case it is ++ # safe to assume OpenGL backend ++ set(VTK_RENDERING_BACKEND "OpenGL") ++ endif() ++ message(STATUS "VTK_MAJOR_VERSION ${VTK_MAJOR_VERSION}, rendering backend: ${VTK_RENDERING_BACKEND}") + if (PCL_SHARED_LIBS OR + (NOT (PCL_SHARED_LIBS) AND NOT (VTK_BUILD_SHARED_LIBS))) + set(VTK_FOUND TRUE) +@@ -377,6 +382,11 @@ if(WITH_VTK AND NOT ANDROID) + option (VTK_USE_COCOA "Use Cocoa for VTK render windows" ON) + MARK_AS_ADVANCED (VTK_USE_COCOA) + endif (APPLE) ++ if(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL") ++ set(VTK_RENDERING_BACKEND_OPENGL_VERSION "1") ++ elseif(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL2") ++ set(VTK_RENDERING_BACKEND_OPENGL_VERSION "2") ++ endif() + set(HAVE_VTK ON) + else () + set(VTK_FOUND OFF) +diff --git a/outofcore/src/visualization/outofcore_cloud.cpp b/outofcore/src/visualization/outofcore_cloud.cpp +index eaf490c..b08d30e 100644 +--- a/outofcore/src/visualization/outofcore_cloud.cpp ++++ b/outofcore/src/visualization/outofcore_cloud.cpp +@@ -21,7 +21,10 @@ + + // PCL - visualziation + #include <pcl/visualization/common/common.h> ++ ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + #include <pcl/visualization/vtk/vtkVertexBufferObjectMapper.h> ++#endif + + // VTK + #include <vtkVersion.h> +@@ -251,11 +254,18 @@ OutofcoreCloud::render (vtkRenderer* renderer) + { + + vtkSmartPointer<vtkActor> cloud_actor = vtkSmartPointer<vtkActor>::New (); +- vtkSmartPointer<vtkVertexBufferObjectMapper> mapper = vtkSmartPointer<vtkVertexBufferObjectMapper>::New (); +- + CloudDataCacheItem *cloud_data_cache_item = &cloud_data_cache.get(pcd_file); + ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 ++ vtkSmartPointer<vtkVertexBufferObjectMapper> mapper = vtkSmartPointer<vtkVertexBufferObjectMapper>::New (); + mapper->SetInput (cloud_data_cache_item->item); ++#else ++ vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New (); ++ // Usually we choose between SetInput and SetInputData based on VTK version. But OpenGL ≥ 2 automatically ++ // means VTK version is ≥ 6.3 ++ mapper->SetInputData (cloud_data_cache_item->item); ++#endif ++ + cloud_actor->SetMapper (mapper); + cloud_actor->GetProperty ()->SetColor (0.0, 0.0, 1.0); + cloud_actor->GetProperty ()->SetPointSize (1); +diff --git a/pcl_config.h.in b/pcl_config.h.in +index e4b10b0..3c25a06 100644 +--- a/pcl_config.h.in ++++ b/pcl_config.h.in +@@ -71,3 +71,7 @@ + /* Address the cases where on MacOS and OpenGL and GLUT are not frameworks */ + #cmakedefine OPENGL_IS_A_FRAMEWORK + #cmakedefine GLUT_IS_A_FRAMEWORK ++ ++/* Version of OpenGL used by VTK as rendering backend */ ++#define VTK_RENDERING_BACKEND_OPENGL_VERSION ${VTK_RENDERING_BACKEND_OPENGL_VERSION} ++ +diff --git a/visualization/CMakeLists.txt b/visualization/CMakeLists.txt +index 26bfd7c..940fc8e 100644 +--- a/visualization/CMakeLists.txt ++++ b/visualization/CMakeLists.txt +@@ -50,8 +50,6 @@ if(build) + src/common/float_image_utils.cpp + src/vtk/pcl_image_canvas_source_2d.cpp + src/vtk/pcl_context_item.cpp +- src/vtk/vtkVertexBufferObject.cxx +- src/vtk/vtkVertexBufferObjectMapper.cxx + src/vtk/vtkRenderWindowInteractorFix.cpp + ) + if("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_LESS "5.6") +@@ -67,6 +65,13 @@ if(build) + ) + endif("${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}" VERSION_GREATER "5.6") + ++ if(VTK_RENDERING_BACKEND_OPENGL_VERSION VERSION_LESS 2) ++ list(APPEND srcs ++ "src/vtk/vtkVertexBufferObject.cxx" ++ "src/vtk/vtkVertexBufferObjectMapper.cxx" ++ ) ++ endif() ++ + set(incs + "include/pcl/${SUBSYS_NAME}/eigen.h" + "include/pcl/${SUBSYS_NAME}/boost.h" +@@ -127,11 +132,16 @@ if(build) + set(vtk_incs + "include/pcl/${SUBSYS_NAME}/vtk/pcl_image_canvas_source_2d.h" + "include/pcl/${SUBSYS_NAME}/vtk/pcl_context_item.h" +- "include/pcl/${SUBSYS_NAME}/vtk/vtkVertexBufferObject.h" + "include/pcl/${SUBSYS_NAME}/vtk/vtkRenderWindowInteractorFix.h" +- "include/pcl/${SUBSYS_NAME}/vtk/vtkVertexBufferObjectMapper.h" + ) + ++ if(VTK_RENDERING_BACKEND_OPENGL_VERSION VERSION_LESS 2) ++ list(APPEND vtk_incs ++ "include/pcl/${SUBSYS_NAME}/vtk/vtkVertexBufferObject.h" ++ "include/pcl/${SUBSYS_NAME}/vtk/vtkVertexBufferObjectMapper.h" ++ ) ++ endif() ++ + # on apple, a workaround is used for the cocoa render window interactor + if(APPLE) + list(APPEND srcs +diff --git a/visualization/include/pcl/visualization/interactor_style.h b/visualization/include/pcl/visualization/interactor_style.h +index 7cc7210..6b64fc5 100644 +--- a/visualization/include/pcl/visualization/interactor_style.h ++++ b/visualization/include/pcl/visualization/interactor_style.h +@@ -157,8 +157,10 @@ namespace pcl + void + setRendererCollection (vtkSmartPointer<vtkRendererCollection> &rens) { rens_ = rens; } + +- /** \brief Pass a pointer to the actor map +- * \param[in] use_vbos ++ /** \brief Use Vertex Buffer Objects renderers. ++ * This is an optimization for the obsolete OpenGL backend. Modern OpenGL2 backend (VTK ≥ 6.3) uses vertex ++ * buffer objects by default, transparently for the user. ++ * \param[in] use_vbos set to true to use VBOs + */ + inline void + setUseVbos (const bool use_vbos) { use_vbos_ = use_vbos; } +@@ -282,7 +284,7 @@ namespace pcl + /** \brief The maximum resizeable window width/height. */ + int max_win_height_, max_win_width_; + +- /** \brief The maximum resizeable window width/height. */ ++ /** \brief Boolean that holds whether or not to use the vtkVertexBufferObjectMapper*/ + bool use_vbos_; + + /** \brief Set to true if the grid actor is enabled. */ +diff --git a/visualization/include/pcl/visualization/pcl_visualizer.h b/visualization/include/pcl/visualization/pcl_visualizer.h +index 418c3c2..f62dc98 100644 +--- a/visualization/include/pcl/visualization/pcl_visualizer.h ++++ b/visualization/include/pcl/visualization/pcl_visualizer.h +@@ -1859,6 +1859,8 @@ namespace pcl + setSize (int xw, int yw); + + /** \brief Use Vertex Buffer Objects renderers. ++ * This is an optimization for the obsolete OpenGL backend. Modern OpenGL2 backend (VTK ≥ 6.3) uses vertex ++ * buffer objects by default, transparently for the user. + * \param[in] use_vbos set to true to use VBOs + */ + void +diff --git a/visualization/src/interactor_style.cpp b/visualization/src/interactor_style.cpp +index 9e9fdaf..f443b6b 100644 +--- a/visualization/src/interactor_style.cpp ++++ b/visualization/src/interactor_style.cpp +@@ -64,7 +64,9 @@ + #include <vtkPointPicker.h> + #include <vtkAreaPicker.h> + ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + #include <pcl/visualization/vtk/vtkVertexBufferObjectMapper.h> ++#endif + + #define ORIENT_MODE 0 + #define SELECT_MODE 1 +@@ -660,6 +662,7 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () + data->SetPoints (points); + data->SetVerts (vertices); + // Modify the mapper ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + if (use_vbos_) + { + vtkVertexBufferObjectMapper* mapper = static_cast<vtkVertexBufferObjectMapper*>(act->actor->GetMapper ()); +@@ -668,6 +671,7 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () + act->actor->SetMapper (mapper); + } + else ++#endif + { + vtkPolyDataMapper* mapper = static_cast<vtkPolyDataMapper*>(act->actor->GetMapper ()); + #if VTK_MAJOR_VERSION < 6 +@@ -704,6 +708,7 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () + vtkPolyData *data = static_cast<vtkPolyData*>(act->actor->GetMapper ()->GetInput ()); + data->GetPointData ()->SetScalars (scalars); + // Modify the mapper ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + if (use_vbos_) + { + vtkVertexBufferObjectMapper* mapper = static_cast<vtkVertexBufferObjectMapper*>(act->actor->GetMapper ()); +@@ -714,6 +719,7 @@ pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown () + act->actor->SetMapper (mapper); + } + else ++#endif + { + vtkPolyDataMapper* mapper = static_cast<vtkPolyDataMapper*>(act->actor->GetMapper ()); + mapper->SetScalarRange (minmax); +diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp +index dc91674..40e516c 100644 +--- a/visualization/src/pcl_visualizer.cpp ++++ b/visualization/src/pcl_visualizer.cpp +@@ -63,9 +63,12 @@ + #include <vtkPointPicker.h> + + #include <pcl/visualization/boost.h> +-#include <pcl/visualization/vtk/vtkVertexBufferObjectMapper.h> + #include <pcl/visualization/vtk/vtkRenderWindowInteractorFix.h> + ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 ++#include <pcl/visualization/vtk/vtkVertexBufferObjectMapper.h> ++#endif ++ + #include <vtkPolyLine.h> + #include <vtkPolyDataMapper.h> + #include <vtkRenderWindow.h> +@@ -84,7 +87,6 @@ + #include <vtkRenderWindowInteractor.h> + #include <vtkAreaPicker.h> + #include <vtkXYPlotActor.h> +-#include <vtkOpenGLHardwareSupport.h> + #include <vtkOpenGLRenderWindow.h> + #include <vtkJPEGReader.h> + #include <vtkBMPReader.h> +@@ -92,6 +94,7 @@ + #include <vtkPNGReader.h> + #include <vtkTIFFReader.h> + #include <vtkLookupTable.h> ++#include <vtkTextureUnitManager.h> + + #include <pcl/visualization/common/shapes.h> + #include <pcl/visualization/pcl_visualizer.h> +@@ -1079,6 +1082,7 @@ pcl::visualization::PCLVisualizer::createActorFromVTKDataSet (const vtkSmartPoin + if (!actor) + actor = vtkSmartPointer<vtkLODActor>::New (); + ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + if (use_vbos_) + { + vtkSmartPointer<vtkVertexBufferObjectMapper> mapper = vtkSmartPointer<vtkVertexBufferObjectMapper>::New (); +@@ -1111,6 +1115,7 @@ pcl::visualization::PCLVisualizer::createActorFromVTKDataSet (const vtkSmartPoin + actor->SetMapper (mapper); + } + else ++#endif + { + vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New (); + #if VTK_MAJOR_VERSION < 6 +@@ -1157,6 +1162,7 @@ pcl::visualization::PCLVisualizer::createActorFromVTKDataSet (const vtkSmartPoin + if (!actor) + actor = vtkSmartPointer<vtkActor>::New (); + ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + if (use_vbos_) + { + vtkSmartPointer<vtkVertexBufferObjectMapper> mapper = vtkSmartPointer<vtkVertexBufferObjectMapper>::New (); +@@ -1189,6 +1195,7 @@ pcl::visualization::PCLVisualizer::createActorFromVTKDataSet (const vtkSmartPoin + actor->SetMapper (mapper); + } + else ++#endif + { + vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New (); + #if VTK_MAJOR_VERSION < 6 +@@ -2771,6 +2778,7 @@ pcl::visualization::PCLVisualizer::updateColorHandlerIndex (const std::string &i + vtkPolyData *data = static_cast<vtkPolyData*>(am_it->second.actor->GetMapper ()->GetInput ()); + data->GetPointData ()->SetScalars (scalars); + // Modify the mapper ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + if (use_vbos_) + { + vtkVertexBufferObjectMapper* mapper = static_cast<vtkVertexBufferObjectMapper*>(am_it->second.actor->GetMapper ()); +@@ -2785,6 +2793,7 @@ pcl::visualization::PCLVisualizer::updateColorHandlerIndex (const std::string &i + //style_->setCloudActorMap (cloud_actor_map_); + } + else ++#endif + { + vtkPolyDataMapper* mapper = static_cast<vtkPolyDataMapper*>(am_it->second.actor->GetMapper ()); + mapper->SetScalarRange (minmax); +@@ -3223,19 +3232,18 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, + #endif + + vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New (); +- vtkOpenGLHardwareSupport* hardware = vtkOpenGLRenderWindow::SafeDownCast (win_)->GetHardwareSupport (); +- if (!hardware) ++ 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 +3287,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh, + } // end of multi texturing + else + { +- if ((mesh.tex_materials.size () > 1) && (!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"); + +@@ -4297,8 +4305,12 @@ pcl::visualization::PCLVisualizer::resetStoppedFlag () + void + pcl::visualization::PCLVisualizer::setUseVbos (bool use_vbos) + { ++#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 + use_vbos_ = use_vbos; + style_->setUseVbos (use_vbos_); ++#else ++ PCL_WARN ("[PCLVisualizer::setUseVbos] Has no effect when OpenGL version is ≥ 2\n"); ++#endif + } + + ////////////////////////////////////////////////////////////////////////////////////////////// |