MantisBT - VTK
View Issue Details
0015435VTK(No Category)public2015-04-23 11:422016-08-12 09:55
Edson Tadeu M. Manoel 
T.J. Corona 
highminorhave not tried
closedmoved 
6.0.0 
 
TBD
crash
0015435: Crash related to vtkRenderWindow::SetOffScreenRendering
There is a crash in VTK 6 that seems related to setting off-screen rendering to On, and then to Off again. This is a simple failing test case:

```
def test_off_screen_rendering_bug():
    import vtk

    renderer = vtk.vtkRenderer()

    render_window = vtk.vtkRenderWindow()
    render_window.AddRenderer(renderer)

    render_window.Render()

    render_window.SetOffScreenRendering(True)
    render_window.SetOffScreenRendering(False) # <-- Problem happens here

    assert render_window.GetRenderers().GetFirstRenderer().GetRenderWindow() is not None

    render_window.Render() # <-- Crashes here if the assert above is commented out.
```

  The RenderWindow pointer of the renderers are being set to NULL in the `render_window.SetOffScreenRendering(False)` call.

  Note: this is only happening when the attribute OffScreenUseFrameBuffer is 0, because SetOffScreenRendering is invoking CleanUpOffScreenRendering, which is invoking CleanUpRenderers, which sets the RenderWindow to NULL and then it is never attributed back to a valid value (because ContextId is also set to 0, and ResumeScreenRendering only restores the RenderWindow when ContextId != 0). OffScreenUseFrameBuffer is kept as 0 when CreateHardwareOffScreenWindow fails (probably because OpenGL framebuffer extension is also disabled). So, in order to really reproduce this, the framebuffer must be disabled (using remote desktop connection seems to do this).


  This used to work on older versions, so I've tried to trace what changes led to this problem, and I got these commits:

https://gitlab.kitware.com/vtk/vtk/commit/9b6f235663f5db37455a26ea77647a3f693e5f8d [^]

  Authored by: Clinton Stimpson 7 years ago
  ENH: Don't leave the vtkRenderer's RenderWindow NULL after reparenting the vtkRenderWindow.
  Making modifications (add/remove 3D widgets) before the next render would lead to crashes.


https://gitlab.kitware.com/vtk/vtk/commit/a6fa3e375c17771864345763ae2283d47be7aae8 [^]

  Authored by: Burlen Loring 2 years ago
  OpenGL error hunt
  This patch implements OpenGL error checking in VTK. (...)


https://gitlab.kitware.com/vtk/vtk/commit/f7f82536aa867acc64b9a458c60810dd3fbf2b00 [^]

  Authored by: Utkarsh Ayachit 2 years ago
  Fixed regression introduced by a6fa3e375c.
No tags attached.
Issue History
2015-04-23 11:42Edson Tadeu M. ManoelNew Issue
2015-08-26 16:35Berk GeveciAssigned To => T.J. Corona
2015-08-26 16:48T.J. CoronaNote Added: 0035072
2015-08-26 16:48T.J. CoronaStatusbacklog => closed
2015-08-26 16:48T.J. CoronaResolutionopen => unable to reproduce
2015-08-27 08:28Edson Tadeu M. ManoelNote Added: 0035078
2015-08-27 08:28Edson Tadeu M. ManoelStatusclosed => backlog
2015-08-27 08:28Edson Tadeu M. ManoelResolutionunable to reproduce => reopened
2015-08-27 11:16T.J. CoronaNote Added: 0035084
2015-08-27 13:27Edson Tadeu M. ManoelNote Added: 0035086
2016-08-12 09:55Kitware RobotNote Added: 0037384
2016-08-12 09:55Kitware RobotStatusbacklog => closed
2016-08-12 09:55Kitware RobotResolutionreopened => moved

Notes
(0035072)
T.J. Corona   
2015-08-26 16:48   
I am unable to reproduce your crash. Perhaps this bug has already been fixed?
(0035078)
Edson Tadeu M. Manoel   
2015-08-27 08:28   
T.J., did you try to run this using something that disables OpenGL framebuffer extension? For example, you can try to run this in a machine while logged in via remote desktop (mstsc).
(0035084)
T.J. Corona   
2015-08-27 11:16   
Edson, is your VTK installation configured to use OpenGL or OpenGL2? Also, can you add the following four lines to your test after render_window.Render() and return the output?

extensions = vtk.vtkOpenGLExtensionsManager()
extensions.SetRenderWindow(render_window)
extensions.Update()
print extensions.GetExtensionsString()

Thanks!
(0035086)
Edson Tadeu M. Manoel   
2015-08-27 13:27   
It's not OpenGL2 (it doesn't have vtkRenderingOpenGL2).

It is printing:

    GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture
(0037384)
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.