[vtkusers] vtkRendererSource and vtkRenderWindow.

Eric E. Monson emonson at cs.duke.edu
Mon Jun 21 10:02:02 EDT 2010


Hello Eloisa,

Hopefully someone who had actually done this will step in if I get something wrong, but I wanted to get you started in what I think is the correct direction. If you want to do "offscreen rendering", the current method (assuming you're using a fairly recent version of VTK -- 5.4 or 5.6 or git) is to build OSMesa (or maybe your OS comes with it?) and have VTK use that for OpenGL rendering. 

Here's an email from last year explaining a little of this:

http://www.vtk.org/pipermail/vtkusers/2009-April/100419.html

Just make sure you ignore older information you come across which refer to "mangled Mesa", as this isn't supported any more. 

Then, the more current filter (instead of vtkRendererSource) is vtkWindowToImageFilter:

http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html

And there is an example of doing offscreen rendering using this filter on the VTK Examples Wiki page:

http://www.vtk.org/Wiki/VTK/Examples/OffScreenRendering

Good luck,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Jun 21, 2010, at 7:38 AM, Eloisa Bentivegna wrote:

> Hello,
> 
> I would like to visualize some data on the fly, by calling, from my scientific code, a C++ function with a VTK pipeline, ending in an image writer of some sort. In other words, I'd like to dump periodic visualization snapshots as soon as some data becomes available during the simulation.
> 
> So far, I've managed to write a pipeline where my data is used to populate a dataset, which is then visualized using scalar coloring. The problem occurs when I try to write an image with this visualization: for obvious reasons, I would like to have no interaction with any window manager (the code may be running remotely and through batch submission) - all I need is to have the renderings saved to images. I've found the vtkRendererSource class which seems to be doing what I'm looking for: connecting a renderer to an image writer such as, say, vtkJPEGEWriter. However, if I construct a pipeline:
> 
> vtkRenderer -> vtkRendererSource -> vtkJPEGWriter
> 
> without any mention to a vtkRenderWindow, I get an error from vtkRendererSource::RequestInformation saying that "The input renderer has not been set yet". If I do define a vtkRenderWindow, then this window will keep trying to pop up during the execution of my code. Any suggestions to avoid this?
> 
> Many thanks!
> Eloisa
> _______________________________________________
> 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
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list