[vtkusers] Fw: Copiling error with PolyData and DataSet Types.

Samuel Rodríguez Bescos srodrigu at gbt.tfo.upm.es
Fri Nov 29 07:17:03 EST 2002


Hello to all!!!

I'm writing a program that can add a texture in a Sphere. The compilation error is:
  cannot convert parameter 1 from 'class vtkPolyData *' to 'class vtkDataSet *'
          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  Error executing cl.exe.

The code is the next. An the error line is marked.

const char *m_TextureFileName=fl_file_chooser("Input Texture File Name","*.ppm","");

 if (! m_TextureFileName)
 {
  return;
 }

vtkPNMReader *m_TextureReader;
  m_TextureReader=vtkPNMReader::New();
  m_TextureReader->SetFileName(m_TextureFileName);

 vtkTexture  *m_Texture;
  m_Texture=vtkTexture::New();
  m_Texture->SetInput(m_TextureReader->GetOutput());
  m_Texture->InterpolateOn();

vtkSphereSource *m_Sphere;
  m_Sphere=vtkSphereSource::New();
  m_Sphere->SetThetaResolution(7);
  m_Sphere->SetPhiResolution(7);

vtkTextureMapToCylinder *m_Tmapper;
  m_Tmapper=vtkTextureMapToCylinder::New();
  m_Tmapper->SetInput(m_Sphere->GetOutput()); ***************************************************
  m_Tmapper->PreventSeamOn();

 vtkTransformTextureCoords *m_Xform;
  m_Xform=vtkTransformTextureCoords::New();
  m_Xform-> SetInput(m_Tmapper->GetOutput());
  m_Xform-> SetScale (4,4,1);

 vtkDataSetMapper *m_SphereMapper;
  m_SphereMapper=vtkDataSetMapper::New();
  m_SphereMapper->SetInput(m_Xform->GetOutput());

vtkActor *m_SphereActor;
  m_SphereActor=vtkActor::New();
  m_SphereActor->SetMapper(m_SphereMapper);
  m_SphereActor->SetTexture(m_Texture);

vtkRenderer *m_SphereRenderer;
  m_SphereRenderer=vtkRenderer::New();
  m_SphereRenderer->AddActor(m_SphereActor);

vtkRenderWindow *m_RenderWindow;
  m_RenderWindow=vtkRenderWindow::New();
  m_RenderWindow->AddRenderer(m_SphereRenderer);

vtkRenderWindowInteractor *m_RenderWindowInteractor;
  m_RenderWindowInteractor=vtkRenderWindowInteractor::New();
  m_RenderWindowInteractor->SetRenderWindow(m_RenderWindow);
  m_RenderWindow->Render();
  m_RenderWindowInteractor->Start();


I don't know what happens because vtkPolyDataType is inherited from vtkPointSet, and this from vtkDataSet. So, There would have no probles. wouldn't there?.

¿does anybody know what happens?.
¿what can I do to solve the problem?.

Thanks in advance:

Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021129/aab882dc/attachment.htm>


More information about the vtkusers mailing list