[vtkusers] problem with vtkWindowToImageFilter

Wolfram H Volpi whv88240 at Bayou.UH.EDU
Wed Nov 8 15:05:56 EST 2000


I am using vtkWindowToImageFilter on two separate vtkRenderWindows.
Something goes wrong with the first vtkWindowToImageFilter to be rendered.
The last vtkWindowToImageFilter to be rendered looks fine.
Please see the example code below.

################ pipe line-1 is a cone
vtkConeSource cone
  cone SetResolution 5

vtkPolyDataMapper coneMapper
  coneMapper SetInput [cone GetOutput]

vtkActor coneActor
  coneActor SetMapper coneMapper

# create a rendering window and renderer
vtkRenderer ren1
    ren1 AddActor coneActor

vtkRenderWindow renWin1
    renWin1 AddRenderer ren1

################ pipe line-2 is a cube
vtkCubeSource cube
	cube SetXLength 4

vtkPolyDataMapper cubeMapper
  cubeMapper SetInput [cube GetOutput]

vtkActor cubeActor
  cubeActor SetMapper cubeMapper

# create a rendering window and renderer
vtkRenderer ren2
    ren2 AddActor cubeActor

vtkRenderWindow renWin2
    renWin2 AddRenderer ren2

########## something wrong with wtif1
vtkWindowToImageFilter wtif1
	wtif1 SetInput renWin1
	wtif1 Modified

vtkWindowToImageFilter wtif2
	wtif2 SetInput renWin2

########### view2 looks good, but view1 is whitish
# view_ "SetColorWindow 256" and "SetColorLevel 128" make cone bright
again.
vtkImageViewer view1
	view1 SetColorWindow 256
	view1 SetColorLevel 128
	view1 SetInput [wtif1 GetOutput]
	view1 Render

vtkImageViewer view2
	view2 SetColorWindow 256
	view2 SetColorLevel 128
	view2 SetInput [wtif2 GetOutput]
	view2 Render
}
########## renWin1 and renWin2 look good.
renWin1 Render
renWin2 Render
# If order of "renWin1 Render" and "renWin2 Render" are switched,
# then behavior of view1 and view2 are also switched.
# Something goes wrong with the first vtkWindowToImageFilter to be
rendered.

Thank you for all your help,
Wolfv.





More information about the vtkusers mailing list