]> git.pld-linux.org Git - packages/pcl.git/blame - vtkOpenGL2.patch
- one more vtk 7.x fix
[packages/pcl.git] / vtkOpenGL2.patch
CommitLineData
2b7743ff
JR
1From 9cfb00970f7d46f1732149d4c50ba3646f038b6c Mon Sep 17 00:00:00 2001
2From: Sergey Alexandrov <alexandrov88@gmail.com>
3Date: Thu, 11 Feb 2016 22:19:01 +0100
4Subject: [PATCH] Use vtkTextureUnitManager to query the number of available
5 texture units
6
7The new OpenGL2 backend does not have vktOpenGLHardwareSupport class
8which was used before.
9---
10 visualization/src/pcl_visualizer.cpp | 15 +++++++--------
11 1 file changed, 7 insertions(+), 8 deletions(-)
12
13diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp
14index dc91674..007c251 100644
15--- a/visualization/src/pcl_visualizer.cpp
16+++ b/visualization/src/pcl_visualizer.cpp
17@@ -84,7 +84,6 @@
18 #include <vtkRenderWindowInteractor.h>
19 #include <vtkAreaPicker.h>
20 #include <vtkXYPlotActor.h>
21-#include <vtkOpenGLHardwareSupport.h>
22 #include <vtkOpenGLRenderWindow.h>
23 #include <vtkJPEGReader.h>
24 #include <vtkBMPReader.h>
25@@ -92,6 +91,7 @@
26 #include <vtkPNMReader.h>
27 #include <vtkPNGReader.h>
28 #include <vtkTIFFReader.h>
29+#include <vtkTextureUnitManager.h>
30
31 #include <pcl/visualization/common/shapes.h>
32 #include <pcl/visualization/pcl_visualizer.h>
33@@ -3223,17 +3223,18 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh,
34 #endif
35
36 vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New ();
37- vtkOpenGLHardwareSupport* hardware = vtkOpenGLRenderWindow::SafeDownCast (win_)->GetHardwareSupport ();
38+ vtkTextureUnitManager* tex_manager = vtkOpenGLRenderWindow::SafeDownCast (win_)->GetTextureUnitManager ();
39+ if (!tex_manager)
40+ return (false);
41- bool supported = hardware->GetSupportsMultiTexturing ();
42 // Check if hardware support multi texture
43- std::size_t texture_units (hardware->GetNumberOfFixedTextureUnits ());
44- if ((mesh.tex_materials.size () > 1) && supported && (texture_units > 1))
45+ int texture_units = tex_manager->GetNumberOfTextureUnits ();
46+ if ((mesh.tex_materials.size () > 1) && (texture_units > 1))
47 {
48 if (texture_units < mesh.tex_materials.size ())
49 PCL_WARN ("[PCLVisualizer::addTextureMesh] GPU texture units %d < mesh textures %d!\n",
50 texture_units, mesh.tex_materials.size ());
51 // Load textures
52- std::size_t last_tex_id = std::min (mesh.tex_materials.size (), texture_units);
53+ std::size_t last_tex_id = std::min (static_cast<int> (mesh.tex_materials.size ()), texture_units);
54 int tu = vtkProperty::VTK_TEXTURE_UNIT_0;
55 std::size_t tex_id = 0;
56 while (tex_id < last_tex_id)
57@@ -3279,7 +3278,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh,
58 } // end of multi texturing
59 else
60 {
61- if (!supported || texture_units < 2)
62+ if ((mesh.tex_materials.size () > 1) && (texture_units < 2))
63 PCL_WARN ("[PCLVisualizer::addTextureMesh] Your GPU doesn't support multi texturing. "
64 "Will use first one only!\n");
65
This page took 0.043741 seconds and 4 git commands to generate.