[vtkusers] Help (rendering large no. of spheres)
Dharmendra
dharmendra at strandgenomics.com
Wed Oct 30 00:29:47 EST 2002
Hello All,
Well iam sending a peice of code that I have wriiten for rendering.
I think this is where it is getting slowed down.
Can someone go thru the code and suggest me where Iam wrong (if at all).
Directly in C++ is slow .I have created a dll and used it in python it is
dead slow.
coord_dump has basically sphere positions .
sphereSource = vtkSphereSource::New();
sphereSource->SetThetaResolution(9);
sphereSource->SetPhiResolution(9);
sphereSource->SetRadius(2);
ifstream file("F:\\docking\\dock\\dock\\reader\\coord_dump");
cout << file.is_open() <<endl;
char str[10];
float coord[3];
float radius;
file >>str>>radius >> coord[0] >> coord[1] >> coord[2] ;
int i = 0;
while( !file.eof() ){
file >>str>>radius >> coord[0] >> coord[1] >> coord[2] ;
atomPoints->InsertNextPoint(coord);
i++;
}
// Create a data set for the atoms.
atomsPolyData = vtkPolyData::New();
atomsPolyData->SetPoints(atomPoints);
atomPoints->Delete();
// Create atoms, using a vtkGlyph3D object
vtkGlyph3D *atoms = vtkGlyph3D::New();
atoms->SetInput(atomsPolyData);
atoms->SetSource(sphereSource->GetOutput());
atoms->SetScaleFactor(0.7);
atoms->SetScaleModeToScaleByScalar();
// Create the mapper and actor and finish up the visualization pipeline
vtkPolyDataMapper *atomsMapper = vtkPolyDataMapper::New();
atomsMapper->SetInput(atoms->GetOutput());
vtkActor *atomsActor = vtkActor::New();
atomsActor->SetMapper(atomsMapper);
ren->AddActor(atomsActor);
ren->SetBackground(155,133,122);
// interact with data
renWin->Render();
More information about the vtkusers
mailing list