Crash in vtkOpenGLPolyDataMapper for rendering as "phong" and then switching to "flat"
vtkOpenGLPolyDataMapper crashes for the following simple rendering sequence:
- generate a sphere with both point and cell normals
- setup rendering for surface interpolation as 'phong'
- render a first time
- change interpolation to 'flat'
- render again. This will provoke a nullptr access / crash
In vtkOpenGLPolyDataMapper::RenderPieceStart
there will be a nullptr access because HaveCellNormals
is true but CellNormalTexture
is nullptr:
if (this->HaveCellNormals)
{
this->CellNormalTexture->Activate();
}
A simple test case to provoke this crash is attached (feel free to adapt, might be that the CMake part is nor correct because I did not look into the logic of that).
Note: I verified this for version 8.1.0. With current master I cannot execute any of the tests in vtkRenderingOpenGL2CxxTests because they fail to create a window. Looking at the code of vtkOpenGLPolyDataMapper I still believe that this behavior is present in VTK master.TestSurfaceInterpolationSwitch.cxx