<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi!<div><br></div><div>I am working on a feature that should save window snapshot(s) to a file. Environment: Linux, Qt. I used Screenshot.cxx example (<a href="http://www.cmake.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot" target="_blank" style="font-size: 12pt;">http://www.cmake.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot</a>) as a reference and the code generally works. My case is different from this example (and other examples that I could find) in that I need to be able to make multiple snapshots of the same window over time. To support this mode I had to <span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">call </span><a class="el" href="http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html" title="Use a vtkWindow as input to image pipeline. " style="color: rgb(70, 101, 162); font-weight: bold; text-decoration: none; font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">vtkWindowToImageFilter</a><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">'s Modified() method as recommended by documentation for </span><a class="el c_nobdr t_prs" href="http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html" title="Use a vtkWindow as input to image pipeline. " style="color: rgb(70, 101, 162); font-weight: bold; text-decoration: none; font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">vtkWindowToImageFilter</a><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);"> class (otherwise the filter keeps rendering the first image again and again).</span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);"><br></span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">The only problem I have is that if the window gets resized, an attempt to make a new snapshot causes a crash in vtkWindowToImageFilter::Update(). It would appear that he problem is that after initial connection is established (</span><span style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; background-color: rgb(249, 249, 249);">windowToImageFilter</span><span class="sy2" style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; color: rgb(0, 0, 64);">-</span><span class="sy1" style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; color: rgb(0, 0, 128);">></span><span style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; background-color: rgb(249, 249, 249);">SetInput</span><span class="br0" style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; color: rgb(0, 128, 0);">(</span><span style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; background-color: rgb(249, 249, 249);">renderWindow</span><span class="br0" style="font-family: monospace, monospace; font-size: 12pt; line-height: 1.2em; color: rgb(0, 128, 0);">)</span><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">) filter allocates some memory buffer and its size does not get automatically updated when window size changes. I tried re-setting filter input (first to 0 and then back to renderWindow) prior to making each new snapshot but this did not help.</span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);"><br></span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">The solution I use now is that I create a new vtkWindowToImageFilter object every time I need to produce a new snapshot. It works but I wonder if there is a way to re-sync existing filter and a render window after window size changes. I looked through the list of methods for </span><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">vtkWindowToImageFilter</span><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);"> and could not find anything to do the job.</span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);"><br></span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">Thanks,</span></div><div><span style="font-family: Roboto, sans-serif; font-size: 14px; line-height: 22px; background-color: rgb(255, 255, 255);">Dmytro</span></div> </div></body>
</html>