Rendering error in VTK 6.2.0 when using Opengl2
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
If you enable edge visibility on a vtkActor, render the actor, then later disable edge visibility, and render the actor. The actor will be rendered in such a way that you can still see lines from inner faces. (You need to be rendering an actor with inside faces, like an actor where you have 10 cubes right next to each other in each direction.
The issue is caused by GL_POLYGON_OFFSET_FILL being left enabled.
The file that needs modifying is: Rendering\OpenGL2\vtkOpenGLPolyDataMapper.cxx
In: void vtkOpenGLPolyDataMapper::RenderPieceStart(vtkRenderer* ren, vtkActor *actor)
bool draw_surface_with_edges = (prop->GetEdgeVisibility() && prop->GetRepresentation() == VTK_SURFACE);
if ( this->GetResolveCoincidentTopology() || draw_surface_with_edges) { glEnable(GL_POLYGON_OFFSET_FILL);
But then in void vtkOpenGLPolyDataMapper::RenderPieceFinish(vtkRenderer* ren, vtkActor *vtkNotUsed(actor))
if ( this->GetResolveCoincidentTopology()) { glDisable(GL_POLYGON_OFFSET_FILL);
GL_POLYGON_OFFSET_FILL is only disabled if GetResolveCoincidentTopology even though it was enabled by either GetResolveCoincidentTopology or EdgeVisibility. Which causes GL_POLYGON_OFFSET_FILL to remain enabled when EdgeVisibility is enabled and GetResolveCoincidentTopology is disabled. This results in the incorrect rendering issue.