[vtkusers] vtkWindowToImageFilter - black image

Bill Lorensen bill.lorensen at gmail.com
Tue Jun 9 13:03:58 EDT 2015


This example works:

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/Screenshot



On Tue, Jun 9, 2015 at 11:55 AM, Fredrik <frejon at gmail.com> wrote:
> Hi Scott, thanks for the reply. Unfortunately it didn't help. I think I
> remember some other thread with the "ShouldRerender" flag, but I think that
> mentioned it should be windowToImageFilter.ShouldRerenderOff();
> , not on. I tried both anyway, but no change
>
> All the best,
> Fredrik
>
> 2015-06-09 17:33 GMT+02:00 Scott Wittenburg <scott.wittenburg at kitware.com>:
>>
>> Hi Frederik,
>>
>>    I believe I have encountered this before.  What solved it for me was
>> turning on the "ShouldRerender" flag in addition to what you have set.
>> Something like:
>>
>> windowToImageFilter.ShouldRerenderOn();
>>
>> could possibly help.
>>
>> Cheers,
>> Scott
>>
>>
>>
>> On Tue, Jun 9, 2015 at 9:02 AM, Fredrik <frejon at gmail.com> wrote:
>>>
>>> Hello. There are several threads on this topic, and the few I see, the
>>> proposed solutions are not enough or the thread is left unresolved. see
>>> this:
>>>
>>> http://public.kitware.com/pipermail/vtkusers/2014-October/085358.html
>>> http://public.kitware.com/pipermail/vtkusers/2014-October/085294.html
>>>
>>> I still am unable to generate anything else than a black image.
>>> I'm on the latest VTK, under Mac OS X 10.10.  I also tried offscreen
>>> rendering, but no luck.
>>>
>>> Hours of googling and testing solutions have proven unsuccessful, I'd
>>> really appreciate if anyone could help me.
>>>
>>> here's a snippet of my code if you think it'll help
>>>
>>>         tempFile = "xyz.bmp";
>>>         // write to temporary bmp file
>>>         vtkBMPWriter writer = new vtkBMPWriter();
>>>         vtkWindowToImageFilter windowToImageFilter = new
>>> vtkWindowToImageFilter();
>>>         windowToImageFilter.ReadFrontBufferOff();
>>>         windowToImageFilter.SetMagnification(1);
>>>         windowToImageFilter.SetInput(renderWindow);
>>>         windowToImageFilter.SetInputBufferTypeToRGBA();
>>>         windowToImageFilter.ReadFrontBufferOff();
>>>
>>>         windowToImageFilter.Update();
>>>
>>>         windowToImageFilter.ReadFrontBufferOff();
>>>         writer.SetInputConnection(windowToImageFilter.GetOutputPort());
>>>         writer.SetFileName(tempFile);
>>>         writer.Write();
>>>
>>>
>>>
>>> Kind Regards, Fredrik
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>
>
> _______________________________________________
> 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


More information about the vtkusers mailing list