[vtkusers] Take 360º degrees snapshot

Teresa Azevedo dce06003 at fe.up.pt
Fri Jan 9 09:27:44 EST 2009


Hi all.

I use a vtk window to visualize a 3D volume I built using a carving  
method. I would like to take several snapshots of the volume. I try to  
do this with the code below, but all images are equal... Can you help  
me?


(...)

renderWindow->Render();
renderer_interactor->Start();

vtkWindowToImageFilter *winToImg = vtkWindowToImageFilter::New();
winToImg->SetInput(renderWindow);
vtkBMPWriter *writer = vtkBMPWriter::New();

int i;
vtkCamera *camera;
CString filename2;
for (i=0; i<360; i+=36)
{
	camera = renderer->GetActiveCamera();
	camera->Roll(i);
	renderer->SetActiveCamera(camera);
	renderer->Modified();

	winToImg->Update();

	writer->SetInput(winToImg->GetOutput());
	filename2.Format("3Dmodel_snapshot%d.bmp", i);
	writer->SetFileName(filename2);
	writer->Write();
}

(...)

Best regards,
Teresa Azevedo







More information about the vtkusers mailing list