MantisBT - VTK
View Issue Details
0015384VTK(No Category)public2015-03-17 14:382016-08-12 09:55
Sam Fries 
Kitware Robot 
normalminorhave not tried
closedmoved 
6.0.0 
 
TBD
incorrect functionality
0015384: Resizing vtkRenderWindow while OffScreenRendering is True makes bad output
Running the below script will generate output that looks like the associated vtkRenderer isn't getting resized, though when I printed out the results of ren.GetSize(), they reflected the correct size. I've attached the resized PNG output.

import vtk

win = vtk.vtkRenderWindow()
win.SetSize(300, 300)

ren = vtk.vtkRenderer()
ren.SetBackground(.5, .4, .3)

win.AddRenderer(ren)
win.SetOffScreenRendering(True)

filter = vtk.vtkWindowToImageFilter()
filter.SetInput(win)
filter.Update()

writer = vtk.vtkPNGWriter()
writer.SetInputConnection(filter.GetOutputPort())
writer.SetFileName("base.png")
writer.Write()

win.SetSize(600, 300)
filter = vtk.vtkWindowToImageFilter()
filter.SetInput(win)
filter.Update()

writer.SetInputConnection(filter.GetOutputPort())
writer.SetFileName("resized.png")
writer.Write()
No tags attached.
png resized.png (1,225) 2015-03-17 14:38
https://www.vtk.org/Bug/file/20/resized.png
png
Issue History
2015-03-17 14:38Sam FriesNew Issue
2015-03-17 14:38Sam FriesFile Added: resized.png
2015-04-09 15:10David C. LonieNote Added: 0034349
2015-04-09 15:23Sam FriesNote Added: 0034350
2015-04-10 12:17Joe MelnykNote Added: 0034354
2016-07-06 16:47Berk GeveciStatusbacklog => expired
2016-08-12 09:55Kitware RobotNote Added: 0037374
2016-08-12 09:55Kitware RobotStatusexpired => closed
2016-08-12 09:55Kitware RobotResolutionopen => moved
2016-08-12 09:55Kitware RobotAssigned To => Kitware Robot

Notes
(0034349)
David C. Lonie   
2015-04-09 15:10   
What platform is this on? When I run the test on current master, the resized.png is solid brown as expected.

Also be sure to note the warning on vtkWindowToImageFilter: http://www.vtk.org/doc/nightly/html/classvtkWindowToImageFilter.html#details [^] That may be relevant to your issue.
(0034350)
Sam Fries   
2015-04-09 15:23   
This is on OSX 10.8.5. The note indicates that I should be calling modified on the Filter, which isn't strictly necessary in the test I gave above, as I just created a new filter; that said, thanks! You just solved some issues I was having on other stuff with regards to reusing a WindowToImageFilter. I'm still getting this on whatever version of VTK we're using in UV-CDAT.
(0034354)
Joe Melnyk   
2015-04-10 12:17   
I'm experiencing a variation of this issue. When I migrated from VTK 5.10 to 6.1 it came about. I previously had code that would take an actively used (and on-screen rendering) vtkWin32OpenGLRenderWindow, set it to render off-screen, change the size of it, render, then pass it into the WindowToImageFilter and then the vtkBMPWriter. It works fine except the size remains unchanged. Adding the above-mentioned Modified() call has no effect. And again, this issue didn't exist with 5.10. This is on Windows 7 and 8, developing in VS 2013. My only workaround is to delete the actively used render window, recreate it, set it to offscreen, then use it as before. This gives the user a quick black window though when the window is destroyed/recreated.
(0037374)
Kitware Robot   
2016-08-12 09:55   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.