Since the VTK Cxx → Emscripten → (WebAssembly + JS) workflow is almost working, I am interested in getting feedback from the devs and users here, if this is a good idea… @amaclean Lets forget about the size of wasm binaries for the sake of this discussion
As all of the examples are hosted along with source code, it would be nice and helpful to understand what the code does with a live interactive demo in the browser itself… See magnum-octree for example.
Let me elaborate a bit more on why this might help besides the (just for the sake of web) reason…
All VTK examples have an image and that itself helps a lot, but for most interactive examples, it would be cool if the site offered a live experience prior to downloading the tarball and building it…
The concerned examples are:
- Cxx/Interaction
- Cxx/Picking
- Cxx/Visulization
- Cxx/Widgets
I identified a couple of setbacks and tried to fix with MRs wherever possible. Any help on where I could begin to resolve the rest will be appreciated. @ken-martin, @ben.boeckel, @Sebastien_Jourdain
-
VTK + Emscripten build failures (Issue 18263): Attempted a fix in MR 8512. I am no CMake ninja, it would help if a more knowledgeable dev could improve that.
-
A couple of OpenGL features are unimplemented (?) for GLES 3.0. Some discussions at discourse.vtk.org
-
vtkTextureObject
shows "TextureBuffers not supported in OpenGL ES
" for 1D textures. This is required for some Cxx/Widgets examples. I see a todo item there. -
vtkRenderingContextOpenGL2
: undefined GL_POINT_SPRITE, GL_COORD_REPLACE, GL_DRAW_BUFFER. I assume this needs a workaround for GLES 3.0. The immediate solution is to disable RenderingContextOpenGL2, so none of the Plotting examples can run in the web. -
vtkSDL2*
On emscripten platform, the sdl2 interactor and render window must be used. All examples will work without any code edit, only if this is the factory implementation on emscripten platform. Is it enough to do this withvtk_object_factory_declare
? -
vtkSDL2RenderWindowInteractor
: Keyboard event handling was working to a minimum, not on par with x11, win32, cocoa counterparts. This is slightly irrelevant, but done in MR 8561 -
vtkSDL2RenderWindowInteractor
: Touch/Gesture/Joystick input event handling is not on par with x11/win32/ios/android counterparts. It would be a bonus to browse the live demos from a smartphone with touch/gestures…
-
-
The examples that require/demonstrate file based IO can be ignored.
So, 2.2, 2.3, 2.4 and 2.5 seem trivial, but 2.1 and 2.2 are a bit obscure and I’ve no clue where to begin. If Kitware brings in Dawn’s auto generated code for VTK with webgpu, I can probably forget about 2.1 and 2.2 since emscripten supports dawn’s auto generated wgpu code, so I’d call it wishful thinking
I’ve had a minimal emscripten + vtk live site running at https://code.thepanchu.in/vtkDearImGUIInjector/ for a while now. Keyboard handling is unimplemented fully implemented. (It uses vtk-wasm-target docker image based on my pending MR8561 branch)