I’m trying to display multiple canvases on one page (the specific use case is: CadQuery Examples — CadQuery Documentation). I use the following naive approach:
const openglRenderWindow = vtk.Rendering.OpenGL.vtkRenderWindow.newInstance(); renderWindow.addView(openglRenderWindow); openglRenderWindow.setContainer(container);
and execute it multiple times for different container objects. Doing that too many times (20 AFAIR) results in the following warning and some of the canvases not being rendered. In the console I get:
Too many active WebGL contexts. Oldest context will be lost.
It seems that each
vtkRenderWindow creates a new context. Is there a way around it in vtk.js?