Triggering render on camera change

I have multiple render windows that share the same camera, and I want user interaction with any given window to trigger a render for each other window.

Currently if I interact with one render window, causing the shared camera to be modified, then only that window will be redrawn. The other windows have to be poked with a click or some other interaction in order to get them to redraw and display the new camera state.

How can I set up my render windows to listen for camera changes and re-render accordingly? Is there some other approach for getting several render windows to update themselves whenever any given one of them updates?

Ideally you want to do a start/stop animation on them. Usually that is controlled at the application layer.

I don’t see anything about “animation” here: RenderWindow | vtk.js

Can you point me to what you mean?

Thank you, this worked! :grinning_face_with_smiling_eyes:

@Sebastien_Jourdain I need to know: Once I “request animation” from a render window interactor, will it constantly be refreshing the render window? Or is it listening for a certain event? (The events logic is a little difficult for me to follow by directly looking at the code.)

(I want to know if my application should strategically enable/disable animation, or if it can leave it on without worrying about performance overhead while the scene is idle)

request animation will trigger renders in an infinite loop but that loop is somewhat smart as it won’t block the system and it will still allow interaction. Still, you should not let it run forever if you don’t need it.

1 Like

Awesome, thanks for the help!