[vtkusers] Got vtkPolydata out of vtkActor, can get vtkCells out of it, but can't get textureCoordinates
"Maxim Schäfner"
Maxim.Schaefner at gmx.de
Tue May 5 07:20:06 EDT 2009
Hello,
I need realy help with the fellowing. I assigned an vtkActor with a mapped vtkSphereSource. Now I want to get the data of this, on another side of the programm. I managed to get the the vtkPolyData of the vtkActor. Now I can run through the vtkPolyData and get the Cells of it. If I ask for example for the NumberOfCells, I get the correct count and can even calculate facenormals for example.... But if I ask for NumberOfVerts, I get 0. I have no idea, why.
The 3d-object is displayed right with texture and so on...
Thanks for any advice.
Maxim
Some code:
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(10.5);
sphere->SetThetaResolution(5);
sphere->SetPhiResolution(5);
vtkTextureMapToSphere *tmapper = vtkTextureMapToSphere::New(); tmapper->SetInput(sphere->GetOutput()); tmapper->PreventSeamOn();
vtkTransformTextureCoords *xform = vtkTransformTextureCoords::New(); xform->SetInput(tmapper->GetOutput());
vtkDataSetMapper *mapper = vtkDataSetMapper::New(); mapper->SetInput(xform->GetOutput());
vtkBMPReader *cmr = vtkBMPReader::New();
cmr->SetFileName(VTK_DATA_ROOT "cm.bmp");
vtkTexture *cmt = vtkTexture::New();
cmt->SetInputConnection(cmr->GetOutputPort());
cmt->InterpolateOn();
vtkActor *aSphere = vtkActor::New();
aSphere->SetMapper(mapper);
//add to scene...
///////////////////////////////////
OTHER SIDE
//////////////////////////////////
void fct(vtkActor *actor){
...
vtkPolyData *pd = (vtkPolyData*)actor->GetMapper()->GetInput();
cout<<pd->GetNumberOfVerts()<<endl; //=0
cout<<pd->GetNumberOfCells()<<endl; //29 right
...
--
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
More information about the vtkusers
mailing list