[vtkusers] Generate 2D views (store them as images) from 3D models
Sebastien Jourdain
sebastien.jourdain at kitware.com
Mon Jul 12 08:05:38 EDT 2010
Hi Aitor,
it's true that the rendering with OSMesa will be slower. But I do not
know another solution, if you do not want a windows showing even for a
short amount of time.
Seb
On Mon, Jul 12, 2010 at 4:45 AM, Aitor Aldomà <aldoma.aitor at gmail.com> wrote:
> Hi again,
>
> thanks for your answer Seb. Offscreen rendering was the keywords I was
> missing for a successfull search.
> Anyway, I have been reading other posts about this topic and realized that
> rendering with OSMesa will be slower as is not hardware accelerated, is that
> true?. As I intend to use the Offscreen rendering for batch processing, I
> really need the rendering to be fast... I am using Linux with Nvidia Card...
> Any other ideas?
>
> Thanks
>
> On Wed, Jul 7, 2010 at 1:58 PM, Sebastien Jourdain
> <sebastien.jourdain at kitware.com> wrote:
>>
>> Hi Aitor,
>>
>> The only way to prevent the window from poping up, is to use the
>> Offscreen option and compile vtk with OSMesa.
>> Otherwise, even in Offscreen mode, a black window will popup and
>> disappear.
>>
>> Seb
>>
>> On Wed, Jul 7, 2010 at 7:36 AM, Aitor Aldomà <aldoma.aitor at gmail.com>
>> wrote:
>> > Hi everybody,
>> >
>> > I want to generate 2D views of a 3D model and save them as jpeg image.
>> > At
>> > the moment, I am using vtkWindowToImageFilter to obtain the generated
>> > view
>> > from a RenderWindow. The problem is that I dont want to display the
>> > window
>> > on the screen, just wan the RenderWindow to render the view and store
>> > the
>> > result with vtkWindow without showing the window.
>> >
>> > This is part of the code i am using now, the problem is that the window
>> > will
>> > flash for a short time and then disapper. Is there a way to render the
>> > view
>> > without being displayed on the screen???
>> >
>> > renWin = vtk.vtkRenderWindow()
>> > renWin.AddRenderer(ren)
>> > ren.SetBackground(1, 1, 1)
>> > renWin.SetSize(128,128)
>> >
>> > ren.Render()
>> >
>> > winToImageFilter = vtk.vtkWindowToImageFilter()
>> > winToImageFilter.SetInput(renWin);
>> >
>> > renWin.Finalize()
>> > winToImageFilter.Update()
>> >
>> > jw = vtk.vtkJPEGWriter();
>> > jw.SetInput(winToImageFilter.GetOutput());
>> >
>> > jw.SetFileName(fileName + ".jpg");
>> > jw.Write();
>> >
>> > Thanks in advance
>> >
>> >
>> > _______________________________________________
>> > 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