While the proposed solution is a good workaround, this issue has been resolved in VTK. vtkScalarBarActor
relied on OpenGL implementation of vtkPolyDataMapper2D
which targets desktop GL contexts but left out WebGL2 based contexts.
vtkOpenGLES30PolyDataMapper2D
provides a GLES 3.0 (hence WebGL2) compatible implementation. vtkScalarBarActor
, and by extension, all 2D actors with 2D polydata mappers will work out of the box in webassembly without external workarounds.