Uncaught TypeError: model.view.getRenderable is not a function

Hi all,

I’m trying to bind a renderWindowInteractor in my vtk.js project. I tried the following code:

const container = document.querySelector('#container');
const genericRenderWindow = vtkGenericRenderWindow.newInstance({ background: [1, 1, 1]});
genericRenderWindow.setContainer(container);
genericRenderWindow.resize();
const renderer = genericRenderWindow.getRenderer();
const renderWindow = genericRenderWindow.getRenderWindow();
const interactor = vtkRenderWindowInteractor.newInstance();
interactor.setView(container);

However, setView throws the following error: Uncaught TypeError: model.view.getRenderable is not a function

Alternatively, I tried the following:

interactor.setRenderWindow

But this tells me to use setView.

Any idea as to what I’m missing here?

Thanks in advance!

The param in setView should be an openglRenderWindow, you can get it from renderWindow.getViews()[0]

1 Like