I am trying to render into a div element instead of using the full screen renderer. I found this issue post on github:
I am getting error “Uncaught TypeError: Cannot read property ‘newInstance’ of undefined” on the following line:
var openGlRenderWindow = vtk.Rendering.OpenGL.vtkOpenGLRenderWindow.newInstance();
Here is the code I am currently trying:
var renderWindow = vtk.Rendering.Core.vtkRenderWindow.newInstance();
var renderer = vtk.Rendering.Core.vtkRenderer.newInstance();// OpenGlRenderWindow
var openGlRenderWindow = vtk.Rendering.OpenGL.vtkOpenGLRenderWindow.newInstance();
renderWindow.addView(openGlRenderWindow);// Interactor
var interactor = vtk.Rendering.Core.vtkRenderWindowInteractor.newInstance();
interactor.setView(openGlRenderWindow);
interactor.initialize();renderWindow.addRenderer(renderer);
var actor = vtk.Rendering.Core.vtkActor.newInstance();
var mapper = vtk.Rendering.Core.vtkMapper.newInstance();
actor.setMapper(mapper);renderer.setLayer(0);
renderer.addActor(actor);
renderer.resetCamera();var rootContainer = document.getElementById(‘renderwindow’);
openGlRenderWindow.setContainer(rootContainer);
const dims = rootContainer.getBoundingClientRect();
openGlRenderWindow.setSize(dims.width, dims.height);
interactor.bindEvents(rootContainer);
renderWindow.render();
Any help is appreciated.