[vtkusers] Saving a PNG images instead of opening a window
Matthieu Dorier
matthieu.dorier at irisa.fr
Mon Sep 10 09:28:35 EDT 2012
Hello,
I'm new to VTK and I have inherited a visualization code that ends up opening a window to produce its result (I put part of this code below).
I'd like to change it so it doesn't open a window but saves the result in a PNG image instead. How can I do that?
Other question: I know VTK is used by VisIt and ParaView to perform parallel visualization. Does VTK itself supports parallel rendering or is the "parallel" aspect brought by these software? (In other words if I want to do visualization in parallel, can I keep using VTK only or do I have to learn another software?)
Thank you,
Matthieu Dorier
vtkUnstructuredGrid *data = vtkUnstructuredGrid::New();
// here some code filling the data object
// ...
vtkDataSetMapper *mapper = vtkDataSetMapper::New();
mapper->SetInput(data);
mapper->SetScalarRange(scalar_min, scalar_max);
// init actor
vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
// init renderer
vtkRenderer *renderer = vtkRenderer::New();
renderer->AddActor(actor);
renderer->SetBackground(0.1, 0.2, 0.4);
// init window
vtkRenderWindow *window = vtkRenderWindow::New();
window->AddRenderer(renderer);
window->SetSize(512, 512);
// init window interaction and run the window
vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();
interactor->SetRenderWindow(window);
interactor->Initialize();
interactor->Start();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120910/5b9a96fc/attachment.htm>
More information about the vtkusers
mailing list