[vtkusers] Offscreen and onscreen rendering outputs don't match

Viksit Gaur vik.list.vtk at gmail.com
Thu May 18 22:40:55 EDT 2006


Hi all

a) I'm using a vtkWindowToImageFilter object to write the current 
rendered output from a render window of type vtkTkRenderWidget. I seem 
to get all the code right, except that when rendering an animation, only 
the first frame gets written. I do make renWin.OffScreenRenderingOn() - 
but in either case, it doesn't work.

The code:
	
	w2if = vtk.vtkWindowToImageFilter()
         imageWriter = vtk.vtkJPEGWriter()
         particleCount = 0
         particleID = 0
         frameID = 0

         while  particleCount < 100:
                 particleID = 0
                 for j in range(particleCount, particleCount+25):
                         points.InsertPoint(particleID, arr[j][0], 
arr[j][1], arr[j][2])
                         scalars.SetTuple1(particleID, 0.06)
                         particleID = particleID + 1

                 renWin.Render()
                 w2if.SetInput(renWin)
                 imageWriter.SetInput(w2if.GetOutput())
                 imageWriter.SetQuality(100)
                 imageWriter.ProgressiveOff()
                 particleCount = particleCount + 27
                 filename = "image" + repr(frameID) + ".jpg"
                 imageWriter.SetFileName(filename)
                 imageWriter.Write()
                 frameID = frameID + 1
                 points.Reset()

                 points.Modified()

--

results in image0 to n files being written, but all of them have the 
same output. Now, if i was to change the value of particleCount to say 
50, the output image does change, but again, all successive images are 
the same as the first one.

Is this a bug, or do i need to add something to write consecutive image 
frames to the screen?


b) Is there a way to use an OutlineFilter such that its width is fixed, 
rather than have it rely on say, normals of glyphs? Because, if my 
particle glyphs change position, the box compresses and expands - 
something which I don't want.

Thanks,
Viksit


-- 
Viksit Gaur
Social Robotics Lab, Dept of Computer Science
Yale University
http://gundam.cs.yale.edu
http://viksit.com



More information about the vtkusers mailing list