<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<big>Yes, that's what I ended up doing as well. Thanx for the info :-)<br>
Sorry for the late reply, I wasn't able to check my mail all week :-)</big><br>
<blockquote type="cite">
<pre>Hi I came into this problem as well, and the offscreen method proposed, didn't work for me. What I ended up doing was forcing my render window to the top, using the tkinter lift method just before the save. I have the render and the save code bound to two different buttons, included below.
        ################
        # render code
        renwin = Toplevel(self.MainWindow) # create child window
self.PlotWindow = renwin # save it for use from save
subplot = vtk.vtkRenderer()
subplot.SetBackground(1,1,1)
for actor in plotactors: # add actors only if their draw state is true
if (actor[2] == True):
#print "adding %s..."%(actor[1])
subplot.AddActor(actor[0])
#print self.ActorGenerator.GetPlotAspect()
# pack in a vtk render widget
tkrw = vtkTkRenderWidget(renwin, width=WINDOW_WIDTH,height=int(WINDOW_HEIGHT*self.ActorGenerator.GetPlotAspect()))
tkrw.pack(expand=YES, fill=BOTH)
        rw = tkrw.GetRenderWindow()
rw.AddRenderer(subplot)
rw.Modified() # force vtk to updat scalar bar
rw.Render()
self.RenderWidget = tkrw # save this render window
        ###################33
        # save as code
        
        # code to get file name excluded
        self.PlotWindow.lift()
renwin = self.RenderWidget.GetRenderWindow()
renwin.Modified()
renwin.Render()
############
# save png #
############
w2i = vtk.vtkWindowToImageFilter()
w2i.SetInput(renwin)
png = vtk.vtkPNGWriter()
png.SetInput(w2i.GetOutput())
png.SetFileName(sfn)
png.Write()
On Wednesday 27 October 2004 14:14, Jared Cohen wrote:
><i> Ok, the first message didn't seem to get through to the mailing list,
</i>><i> so I'll try this again :-)
</i>><i> ---------------------------------------------------------------------------
</i>><i>---------------------------
</i>><i>
</i>><i> Hi Charles, thanx for the quick reply! :-)
</i>><i>
</i>><i> Yes, I tried offscreen rendering, but it didn't seem to make any
</i>><i> difference at all. Do I need to enable this "MESA" thing before
</i>><i> offscreen rendering will work?
</i>><i>
</i>><i> Charles Boivin wrote:
</i>><i> >Hey Jared,
</i>><i> >
</i>><i> >Have you tried using offscreen rendering? Something like this:
</i>><i> >
</i>><i> >this->renWin->SetOffScreenRendering(1);
</i>><i> >
</i>><i> >... take a snapshot of the render window here
</i>><i> >
</i>><i> >this->renWin->SetOffScreenRendering(0);
</i>><i> >
</i>><i> >I use this to output a series of snapshots (to later create an
</i>><i> >animation) and it seems to work fine for me, although I do not have
</i>><i> >multiple windows that overlap each other.
</i>><i> >
</i>><i> >Hope this helps,
</i>><i> >
</i>><i> >Charles
</i>><i> >
</i>><i> >>>>"Jared Cohen" <<a
href="http://www.vtk.org/mailman/listinfo/vtkusers">Jared.Cohen at noaa.gov</a>> 10/27/04 11:35am >>>
</i>><i> >
</i>><i> > Hi all. I'm part of a team that's building a large, multi-window GUI;
</i>><i> >
</i>><i> >one of the windows contains the VTK RenderWindow. We implemented a
</i>><i> >function to save the scene as a PNG, but there's a problem: if any of
</i>><i> >the other windows are in the way of the RenderWindow, they get
</i>><i> >incorporated into the resulting PNG snapshot! What I want to do is take
</i>><i> >
</i>><i> >a snapshot of ONLY the contents of the RenderWindow, regardless of
</i>><i> >whether or not there are other windows in front of the RenderWindow. Is
</i>><i> >
</i>><i> >there a way to do this?
</i></pre>
</blockquote>
</body>
</html>