[vtkusers] screen shot get clippet
Gilad Arnon
gilad.arnon at massivit.com
Tue Aug 4 02:22:20 EDT 2015
Hi all,
I'm trying to get a png file out of my polydata.
(I take several pictures from different angles.)
but sometimes the outcome is clipped.
this is my code
vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();
reader->SetFileName(name);
reader->Update();
inputPolyData = reader->GetOutput();
vtkSmartPointer<vtkPolyDataMapper> inputPolyMapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
inputPolyMapper->SetInputData(inputPolyData);
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(inputPolyMapper);
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
vtkSmartPointer<vtkAxesActor> axes =
vtkSmartPointer<vtkAxesActor>::New();
vtkSmartPointer<vtkOrientationMarkerWidget> axisWidget =
vtkSmartPointer<vtkOrientationMarkerWidget>::New();
axisWidget->SetOutlineColor(0.9300, 0.5700, 0.1300);
axisWidget->SetOrientationMarker(axes);
axisWidget->SetInteractor(interactor);
renderWindow->AddRenderer(renderer);
axisWidget->SetEnabled(1);
axisWidget->InteractiveOff();
renderWindow->SetOffScreenRendering(1);
renderer->AddActor(actor);
vtkSmartPointer<vtkLightKit> lightKit = vtkSmartPointer<vtkLightKit>::New();
lightKit->AddLightsToRenderer(renderer);
renderer->ResetCamera();
renderWindow->Render();
vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter =
vtkSmartPointer<vtkWindowToImageFilter>::New();
windowToImageFilter->SetInput(renderWindow);
windowToImageFilter->SetMagnification(3);
windowToImageFilter->SetInputBufferTypeToRGBA();
windowToImageFilter->Update();
for example I receive this picture for a rectangle:
[image: Inline image 1]
Can someone assist?
Thanks,
Gilad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150804/21902f35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rect.png
Type: image/png
Size: 13713 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150804/21902f35/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rect.png
Type: image/png
Size: 13713 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150804/21902f35/attachment-0001.png>
More information about the vtkusers
mailing list