Skip to content

WIP: Fix OpenGL errors when destroying vtkWin32OpenGLRenderWindow

Max Smolens requested to merge msmolens/vtk:fix-win32-opengl-errors into master

This commit affects the OpenGL (old) backend.

Commit 49802a3d changed the behavior of vtkWin32OpenGLRenderWindow::CleanUpRenderers() to set the render window on each of the renderers to 'this'. This results in OpenGL errors when the vtkWin32OpenGLRenderWindow destructor calls ren->SetRenderWindow(NULL), because the OpenGL context is already destroyed.

The OpenGL errors are similar to the following:

Generic Warning: In VTK\Rendering\OpenGL\vtkOpenGLDisplayListPainter.cxx, line 52
failed after ReleaseAllLists 16 OpenGL errors detected
  0 : (1282) Invalid operation
  1 : (1282) Invalid operation
  ...
  15 : (1282) Invalid operation

This commit provides an alternative fix for the original issue that restores the original implementation of CleanUpRenderers() but properly resets the renderers with the current render window in CreateOffScreenDC() and ResumeScreenRendering().

Edited by Max Smolens

Merge request reports