Hello,
1/ I’m facing a problem with vtkRenderWindowInteractor and i don’t know what’s going wrong. The model is correctly displayed but no interaction with it is possible, even though i followed the examples for mouse event on vtk.js.
Js code :
var renderWindow = vtk.Rendering.Core.vtkRenderWindow.newInstance();
var renderer = vtk.Rendering.Core.vtkRenderer.newInstance();
var cone = vtk.Filters.Sources.vtkConeSource.newInstance();
//var model = vtk.Rendering.Misc.vtkOBJReader.newInstance();
var openGLRenderWindow = vtk.Rendering.OpenGL.vtkRenderWindow.newInstance();
renderWindow.addView(openGLRenderWindow);
var actor = vtk.Rendering.Core.vtkActor.newInstance();
var mapper = vtk.Rendering.Core.vtkMapper.newInstance();
mapper.setInputConnection(cone.getOutputPort());
actor.setMapper(mapper);
renderer.addActor(actor);
renderer.resetCamera();
renderWindow.addRenderer(renderer);
var container = document.getElementById("model");
openGLRenderWindow.setContainer(container);
var size = container.getBoundingClientRect();
openGLRenderWindow.setSize(size.width, size.height);
var interactor = vtk.Rendering.Core.vtkRenderWindowInteractor.newInstance();
interactor.setView(openGLRenderWindow);
interactor.initialize();
interactor.bindEvents(container);
renderWindow.render();
2/ I take advantage of this topic to ask something else :
“var model = vtk.Rendering.Misc.vtkOBJReader.newInstance();” is an error.
I can’t see good examples on OBJReader with Js. Can someone guide me a little on how it works ?
Thank you, any information will be appreciated.