Resizing canvas using interactor (WASM with threading)

I have replicated the setup from vtkWasmBenchmarks, where I use vtkRenderWindowInteractor::InteractorManagesTheEventLoop = false. It works perfectly.

I followed the latest build instructions for VTK+WASM (updated a week ago) with threading enabled. I managed to get things to work using SharedArrayBuffer. Threading indeed works, but I am encountering situations where the canvas is not resized correctly (initially) and some LeftButtonReleaseEvents are missing. This, I will need to debug.

Short question:
Would it be an idea to use the vtkWebAssemblyRenderWindowInteractor.h instead of vtkRenderWindowInteractor. I can see from your examples, that you can query the dimensions of the parent window using a canvas id? Also, have you @jaswantp tried a setup with vtkWebAssemblyRenderWindowInteractor and threading?

Thanks in advance

Quick answer:
This was an issue in the way emscripten forwarded resize requests from the web worker to main thread.
See wasm64: html5 callbacks throw type error when proxying to pthread · Issue #21851 · emscripten-core/emscripten · GitHub. It was fixed in emsdk 3.1.60.

There is nothing to change in VTK. Please continue using vtkRenderWindowInteractor. The object factory mechanism automatically selects vtkWebAssemblyRenderWindowInteractor for you.

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11178 updates VTK to use emsdk 3.1.60

1 Like

Thank you. We are using 3.1.56. Will update to 3.1.60

Also I noticed that the vtkWebAssemblyInteractor.js was not installed, but it is fixed now, I see