[vtkusers] rendering takes ages when vtkBMPWriter->Write() is in the loop

Niels Bakker n.h.bakker at amc.uva.nl
Thu Sep 4 07:04:57 EDT 2003


Dear all,

I try to grab images that I render of an imported vrml dataset with
vtkWindowToImageFilter and vtkBMPWriter. Except for the first time I render,
all rendering takes ages (30 secs). If I delete the this->bmpwriter->Write()
statement the loop is fast.

Does anyone have an idea what I am doing wrong??

Below is the essence of my code:

this->renwin1 = vtkRenderWindow::New();
this->vrmlimporter = vtkVRMLImporter::New();
this->vrmlimporter->SetFileName("./images/vrml/test.wrl");
this->vrmlimporter->SetRenderWindow(this->renwin1);
this->vrmlimporter->Read();
this->ren1 = this->vrmlimporter->GetRenderer();

// then in a repeating loop I have the following..
this->renwin1->Render();
this->grabber1 = vtkWindowToImageFilter::New();
this->grabber1->SetInput(this->renwin1);
this->bmpwriter = vtkBMPWriter::New();
this->bmpwriter->SetInput(grabber1->GetOutput());
this->bmpwriter->SetFileName("test.bmp");
this->bmpwriter->Write();
this->grabber1->Delete();
this->bmpwriter->Delete();

// If I don't delete and remake the vtkWindowToImageFilter every time I
don't get to see all primitives (even after calling Modified and
UpdateWholeExtent)

All suggestions are welcome....

Niels Bakker

n.h.bakker at amc.uva.nl




More information about the vtkusers mailing list