[vtkusers] screen shot get clippet
Bill Lorensen
bill.lorensen at gmail.com
Tue Aug 4 08:13:55 EDT 2015
Before
renderWindow->Render();
do
renderer->ResetCameraClippingRange();
On Tue, Aug 4, 2015 at 2:22 AM, Gilad Arnon <gilad.arnon at massivit.com>
wrote:
> 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.
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150804/811d00b7/attachment-0001.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/811d00b7/attachment-0001.png>
More information about the vtkusers
mailing list