[vtkusers] How to capture images from ONLY the RenderWindow?

tom fogal tfogal at apollo.sr.unh.edu
Wed Oct 27 16:05:39 EDT 2004


 <s17f89f5.020 at mailwest.rwdiwest.com>"Charles Boivin" writes:
>Hey Jared,
>
>Have you tried using offscreen rendering? Something like this:
>
>this->renWin->SetOffScreenRendering(1);
>
>... take a snapshot of the render window here
>
>this->renWin->SetOffScreenRendering(0);

I can confirm this to work.

We also ran into this issue and its a huge hassle. Luckily for our app
we mostly WANT to do offscreen rendering so its not so bad.

It sounds like you need to both display the window and save the image.
I think the solution for you is to have two render windows, one
onscreen and one offscreen, and throw the actors at both.
It will be slow but I don't see much of an alternative at this time.

If you're on any sort of UNIX, I'd recommend you look into Glen
Lehmann/John Shalf's vtkXOpenGLOffscreenRenderWindow at:

http://www.imaging.robarts.ca/~glehmann/OffScreen/OffScreen.html

This is also mentioned on the wiki: http://www.vtk.org/Wiki/VTK_Classes.

If you're on windows, the SetOffScreenRendering mentioned by Charles
should work.

HTH, good luck.

-tom

<snip>

>>>> "Jared Cohen" <Jared.Cohen at noaa.gov> 10/27/04 11:35am >>>
>  Hi all. I'm part of a team that's building a large, multi-window GUI;
>
>one of the windows contains the VTK RenderWindow. We implemented a 
>function to save the scene as a PNG, but there's a problem: if any of 
>the other windows are in the way of the RenderWindow, they get 
>incorporated into the resulting PNG snapshot! What I want to do is take
>a snapshot of ONLY the contents of the RenderWindow, regardless of 
>whether or not there are other windows in front of the RenderWindow. Is
>there a way to do this?



More information about the vtkusers mailing list