[vtkjs] Split view with linked camera - am I doing it right?

Hello all,

I implemented a split view with linked cameras, similar to what paraview offers, using vtkjs. For this, I instantiated 2 vtkFullScreenRenderWindow with divs that span half the screen.

left = vtkFullScreenRenderWindow.newInstance();
right = vtkFullScreenRenderWindow.newInstance();

left.getContainer().style.width = "50%"
left.resize()

right.getContainer().style.width = "50%"
right.getContainer().style.left = "50%"
right.resize()

Then I bounded the events of their interactors to the other divs:

left.getInteractor().bindEvents(right.getContainer());
right.getInteractor().bindEvents(left.getContainer());

Finally, once the polydatas are mapped and their actors are added to each renderer, I initialize the camera this way:

left.getRenderer().resetCamera()
left.getRendererWindow().render()
right.setActivateCamera(left.getActiveCamera())
right.getRendererWindow().render()

This works but I was wondering if this is the proper way to achieve my split view with linked cameras or if there was something less hackish available.

Also, I experience some weird (relatively minor) CameraClippingRange issues and was wondering if they could be related to my split view implementation.

Thanks in advance for your help and suggestions!

I was doing split screen by using a single render window and setting the viewport properties of each renderer that I added to the render window.

globeRenderer1.setLayer(0);
globeRenderer1.setActiveCamera(renCam);
globeRenderer1.setViewport(0.001, 0.01, 0.495, 0.99);

globeRenderer2.setLayer(0);
globeRenderer2.setActiveCamera(renCam);
globeRenderer2.setViewport(0.501, 0.01, 0.995, 0.99);

renderWindow.addRenderer(globeRenderer1);
renderWindow.addRenderer(globeRenderer2);

single render window

Oh I see, I did not realize that there was a viewport property I could use. I guess this is more resource-friendly than having two render windows. I will try to change my code accordingly and I’ll post here in case I run into trouble.