Skip to content

PCL 1.9+ VTK 8.2 Compilation failed pcl_visualizer.cpp:3567:88:  #2623

@marcel-bariou

Description

@marcel-bariou

Your Environment

Ubuntu 18.04 LTS
GCC 4.3 VTK 8.2

  • PCL 1.9+ Latest commit 9073f63 2 days ago

Context

I need PCL for PDAL compatibility with VTK capabilities => Compile error Message =>

Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/pcl_visualizer.cpp.o
/home/mbariou/WKSCOMPILE/PCL/pcl/visualization/src/pcl_visualizer.cpp: In member function ‘bool pcl::visualization::PCLVisualizer::addTextureMesh(const pcl::TextureMesh&, const string&, int)’:
/home/mbariou/WKSCOMPILE/PCL/pcl/visualization/src/pcl_visualizer.cpp:3567:88: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
                                                 vtkDataObject::FIELD_ASSOCIATION_POINTS);

Expected Behavior

Seems overloading problem, but not sure if bug is inside VTK (https://www.vtk.org/doc/nightly/html/vtkPolyDataMapper_8h_source.html) or PCL (pcl/visualization/src/pcl_visualizer.cpp)
After several turn around with c_str(), to_string, and stoi() I give up Help needed!

Current Behavior

Code to Reproduce

LINES 3545 to 3585 pcl_visualizer.cpp:3567:88:

    if (tex_id == 0)
      texture->SetBlendingMode(vtkTexture::VTK_TEXTURE_BLENDING_MODE_REPLACE);
    else
      texture->SetBlendingMode(vtkTexture::VTK_TEXTURE_BLENDING_MODE_ADD);
    // add a texture coordinates array per texture
    vtkSmartPointer<vtkFloatArray> coordinates = vtkSmartPointer<vtkFloatArray>::New ();
    coordinates->SetNumberOfComponents (2);
    std::stringstream ss; ss << "TCoords" << tex_id;
    std::string this_coordinates_name = ss.str ();
    coordinates->SetName (this_coordinates_name.c_str ());

    for (std::size_t t = 0; t < mesh.tex_coordinates.size (); ++t)
      if (t == tex_id)
        for (std::size_t tc = 0; tc < mesh.tex_coordinates[t].size (); ++tc)
          coordinates->InsertNextTuple2 (mesh.tex_coordinates[t][tc][0],
                                         mesh.tex_coordinates[t][tc][1]);
      else
        for (std::size_t tc = 0; tc < mesh.tex_coordinates[t].size (); ++tc)
          coordinates->InsertNextTuple2 (-1.0, -1.0);
      
    mapper->MapDataArrayToMultiTextureAttribute(tu,
                                                this_coordinates_name.c_str (),
                                                vtkDataObject::FIELD_ASSOCIATION_POINTS);  
   
    polydata->GetPointData ()->AddArray (coordinates);
    actor->GetProperty ()->SetTexture (tu, texture);
    ++tex_id;
  }

  // set mapper
  actor->SetMapper (mapper);
  addActorToRenderer (actor, viewport);

  // Save the pointer/ID pair to the global actor map
  (*cloud_actor_map_)[id].actor = actor;

  // Save the viewpoint transformation matrix to the global actor map
  (*cloud_actor_map_)[id].viewpoint_transformation_ = transformation;

  return (true);
}

Possible Solution

I make several Turn around in the code zone, a bove I failed, some help needed thanks!

Maintainer edit: Aesthetics

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions