Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
marcel-bariou opened this issue Nov 17, 2018 · 2 comments
Closed

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

marcel-bariou opened this issue Nov 17, 2018 · 2 comments

Comments

@marcel-bariou
Copy link

marcel-bariou commented Nov 17, 2018

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

@SergioRAgostinho
Copy link
Member

Hey. This definitely seems related to #2612, so for the time being you can try incorporating the changes introduced there and see if they solve the issue for you. As you can see in #2612 and related PRs, that section of the code has been going back and forth with changes and we're still trying to figure out how exactly to proceed.

Give it a try and let us know.

@marcel-bariou
Copy link
Author

marcel-bariou commented Nov 17, 2018

Hey. This definitely seems related to #2612,
Give it a try and let us know.
I seems to work ! I tell you when completed ! Thanks!
Work completed everything OK thanks to #2612

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants