[vtkusers] VTK crashes when vtkWindowToImageFilter is used for saving window snapshots
Dmytro Burenkov
dburenkov at outlook.com
Thu Jan 15 17:28:52 EST 2015
Hi!
I am working on a feature that should save window snapshot(s) to a file. Environment: Linux, Qt. I used Screenshot.cxx example (http://www.cmake.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot) 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 call vtkWindowToImageFilter's Modified() method as recommended by documentation for vtkWindowToImageFilter class (otherwise the filter keeps rendering the first image again and again).
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 (windowToImageFilter->SetInput(renderWindow)) 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.
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 vtkWindowToImageFilter and could not find anything to do the job.
Thanks,Dmytro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150115/87fa3bf4/attachment.html>
More information about the vtkusers
mailing list