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

John Biddiscombe jbiddiscombe at skippingmouse.co.uk
Fri Nov 29 10:25:18 EST 2002


Add #include "vtkPolyData.h" to your code.

JB

----- Original Message -----
From: "Samuel Rodríguez Bescos" <srodrigu at gbt.tfo.upm.es>
To: <vtkusers at public.kitware.com>
Sent: Friday, November 29, 2002 12:17 PM
Subject: [vtkusers] Fw: Copiling error with PolyData and DataSet Types.



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





More information about the vtkusers mailing list