VTK 7.1 Upgrade

Branches containing work-in-progress

Burlen Loring created a github repository, and I have put all my work on a branch called remove_custom_wrappers.

This branch/repo is not currently up-to-date with VisIt's trunk. So, I resurrected an SVN branch called VTK-6.3-port and you can check it out using the following command (using the script from VisIt's src/svn_bin subdirectory)

co_branch VTK-6.3-port  src -user bonnell

It is up-to-date with trunk AND contains all the changes I made to the github repo.

Building VTK

  • VTK 7.1 builds its own glew, so a patch was added to bv_vtk.sh that allows switching between OpenGL and OSMesa at runtime. This is the same 'patch' used on VisIt's third_party_builtin version of glew.
  • As of the writing of this wiki page, VTK-7.1 not yet released, so any new builds can use latest vtk-master, keeping in mind that the api may still be in flux.
  • VTK CMake flag changes in bv_vtk.sh
    • VTK_REPORT_OPENGL_ERRORS is turned on during this ongoing development
    • VTK_LEGACY_REMOVE has been turned on
    • VTK_RENDERING_BACKEND is new, is set to OpenGL2, but is technically no longer needed, as it is the default with VTK-7.1
  • Module changes
    • Module_vtkRenderingFreeTypeOpenGL -- no longer exists
    • Module_vtkRenderingOpenGL2 -- new, replaces Module_vtkRenderingOpenGL when OpenGL2 backend is requested


  • bv_mesh.sh was modified to build Mesa version 11.2.2
  • configure flags were changed, using suggestions from a Kitware blog.
  • Issues with this configuration/setup:
    • When VisIt is built with this OSMesa, many test-suite images come out blank.
      • Update 3/27/17 (Kathleen) -- this doesn't appear to be true when I build and run on my local linux system, except for plots that haven't yet been updated, so I'm not sure this is truly an issue.
  • Performance needs to be tested.

VisIt changes

  • glew has been removed from third_party_builtin
  • FindVisItVTK.cmake was modified to include vtkglew in the list of required modules, and to add GLEW_LIB CMake var.

CMakeLists.txt changes

  • References to 'glew' changed to '${GLEW_LIB}'.
  • References to vtkRenderingOpenGL changed to vtkRenderingOpenGL2
  • References to vtkRenderingFreeTypeOpenGL have been removed.
  • References to vtkftgl have been removed.

VTK API changes

vtkStreamingDemandDrivenPipeline::SetUpdateGhostLevel(outMesh->GetInformation(), 0);
// is now
outMesh->GetInformation()->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS(), 0);
some_vtk_dataArray->SetTupleValue(tuple_id, tuple_ptr);
// is now
some_vtk_dataArray->SetTypedTuple(tuple_id, tuple_ptr);
some_vtk_dataArray->InsertNextTupleValue(tuple_id, tuple_ptr);
// is now
some_vtk_dataArray->InsertNextTypedTuple(tuple_id, tuple_ptr);

vtkMatrix4x4 no longer has [] operators, must use M->SetElement:

(*M)[0][0] = atts.GetM00();
// is now
M->SetElement(0, 0, atts.GetM00());
  • vtkDataArrayTemplate is deprecated. Two new template classes took its place: vtkAOSDataArrayTemplate and vtkSOADataArrayTemplate. VisIt's usage of vtkDataArrayTemplate was modified to use vtkAOSDataArrayTemplate.
  • GetMTime() in VTK classes now returns vtkMTimeType instead of unsigned long.
  • vtkOpenGLExtensionManager does not exist for the OpenGL2 backend.


Note: Customizations to vtk mappers really need to take place at the vtkPolyDataMapper/vtkOpenGLPolyDataMapper level. Mapper classes higher up in the hierarchy generally do not have access to methods that make customizations possible. This has informed the changes made to VisIt's mapping classes. Goal for mapper changes is to utilize native vtk rendering code as much as possible and to simplify avtMapper and its derivations.

  • Plot-specific mapper customizations now live with the plot. Unless a particular customization (like point glyphing) applies to multiple plots.
  • Custom vtk mappers with OpenGL overrides need a vtkObjectFactory (ala the one used in avt/Plotter/vtk/InitVTKRendering) to register their overrides.
    • New files in CMake subdir to facilitate this, without the classes needing to reside outside of the plugin:
      • VisItObjectFactory.cmake
      • VisItObjectFactory.h.in
      • VisItObjectFactory.C.in
    • The plot's CMakeList.txt file calls the necessary macros.
    • The plot's avt mapper calls VTK's VTK_MODULE_INIT macro to utilize the factory generated during the configuration stage.
    • See Molecule plot for an example.
  • Here's a link to VTK wiki describing the new [Shader] and examples of how to customize.
  • Removed vtkVisItDataSetMapper and derived classes.
    • vtkStructuredGridMapper (and its OpenGL derivation)
    • vtkRectilinearGridMapper (and its OpenGL derivation)
  • Removed vtkTexturedPointsPainter
  • Removed vtkOSMesaRenderWindow
  • Added vtkPointMapper and its OpenGL derivation.
    • This mapper will render points as GL points or Sphere imposters
  • Added vtkPointGlyphMapper
    • This mapper will render points as Glyphs, or GLpoints or Sphere imposters. The latter two being handled by vtkPointMapper.
    • Much of the code in this class was moved from avtPointGlypher.
  • Added avtPointMapper, which derives directly from atMapper and utilizes vtkPointGlyphMapper.
    • Removed avtPointGlypher, because its functionality was subsumed by vtkPointGlyhMapper and avtPointMapper.
    • All avtXXXPointGlyphMappers now inherit from avtPointMapper, and only handle point rendering.
    • avtVariableMapper and avtLevelsMapper now virtually inherit avtMapper
    • SetPointSize was removed from avtVariableMapper and avtLevelsMapper (now handled in avtPointMapper)
  • Removed avtSurfaceAndWireframeRenderer and its OpenGL derivation.
Boundary, Filled Boundary, Subset plots

Modified to use avtLevelsMapper when topological dimension not zero, avtLevelsPointGlyphMapper otherwise.

Histogram Plot

Created avtHistogramMapper, derived directly from avtMapper. It sets edge visibility and edge color in a standard vtkDataSetMapper.

Molecule Plot
  • Created avtMoleculeMapper, derived from avtMapper in order to use new vtk mapper class.
  • Created vtkVisItMoleculeMapper and its OpenGL derivation
    • Borrowed from vtkMoleculeMapepr (DomainsChemistry module), mainly so that the mapper would work with vtkPolyData as input instead of vtkMolecule, and so it would fit within the avtMapper paradigm which expects a vtkDataSetMapper or subclass.
    • Code was moved from avtOpenGLMoleculeRenderer into this new vtk class
  • Removed avtMoleculeRenderer
  • Removed avtOpenGLMoleculeRenderer
  • Removed avtOpenGLAtomTexturer 2D and 3D.
Pseudocolor Plot
  • Created new vtk mapper class: vtkMultiRepMapper
    • Allows different representations (Surface, Wireframe, Points) to be rendered from the same vtkDataSet and from the same vtkMapper/vtkActor pairs.
    • Under the covers it subclasses vtkOpenGLPolyDataMapper in order to override a few of its methods.
  • Created avtPseudocolorMapper, inherits from avtVariableMapper, but utilizes the vtkMultiRepMapper
  • avtVariablePointGlyphMapper still used when topological dimension is 0.
Label Plot
  • almost finished (Kathleen, 3/23/17). Not yet committed to branch.
    • Ironing out kinks with plot not updating when certain attributes change
    • Need to fix crash on Windows when changing variable.
  • Moved bulk of logic from avtLabelRenderer/avtOpenGLLabelRenderer into vtkLabelMapper classes. Took some cues from vtkLabeledDataMapper.
  • Changes to avt/Plotter:
    • Added avtMapper2D class to support use of vtkMapper2D.
    • Added avtMapperBase class, moved common code out of avtMapper into new base class.
  • Will be adding ability to change font family, and set bold/italic.


  • Removed use of vtkVisItTIFFWriter in favor of stock VTK version.
  • OpenFOAM reader -- its custom vtk classes were updated.
  • vtkVisItStructuredGridNormals was removed from avtVertexNormalsFilter.C
    • It was returning normals pointing in the wrong direction, causing 'black' sections of the Pseudocolor plot.
    • More than likely, the cause of the incorrect normals was avtFacelistFilter creating 'inside-out' faces.


  • Curve Plot
    • Basics are done, not committed (Kathleen).
    • Glyphing of points not scaling correctly during zoom.
    • 'Dynamic' reduction of points not implemented
    • 'Fill' not implemented
    • 'Extras -- Create cue for current location' not implemented.
  • Volume plot
  • Surface plot -- is it really needed? This would be a good time to rip it out if not!
  • Revisit removal of custom Structured/Rectilinear mappers. They were created for performance improvements. If re-added back to VisIt, they would need to be reworked to fit with the new rendering paradigm.
  • Investigate OSMesa issues -- is it a configuration or usage problem?'
    • 3/27/17 (Kathleen) not sure there are issues, but we definitely want to test performance.
  • Possibly update plot-plugin-generation code to include a custom avt mapper class.
  • Line stippling is not yet implemented in VTK-7 (except for charts). Need to keep informed if, when implemented, it is still as simple as setting it via vtkProperty.
  • Rendering performance tests, on-screen and off-screen.
    • Depth sorting in avtTransparencyActor is bad
      • Custom mapper work is negated. (all datasets globbed together to sort polygons, then default vtkPolyDataMapper is used).
    • Depth peeling
      • Yields good results with the correct tweaks to settings
      • High Quality results are slower/expensive
      • Needs user education (settings are in Controls->Rendering) eg: default settings for initial pass, how to tweak for quality final image.
  • Rendering artifacts need to be investigated
    • Subset or Filled Boundary plot of multi_rect3d.silo (distinct 'edges' at domain boundaries -- ghosting issue?)
    • Pseudocolor plot of globe (pole's aren't smooth)
    • Unfortunately, this is an intermittent problem! (at least on my Windows laptop).
  • Deleting a plot crashes the engine on Windows (down in our ref_ptr code).