VTK WebAssembly Calling vtkXMLImageDataReader and vtkXMLPolyDataReader with URL's

I have compiled VTK with Emscripten and have gotten the VTK Emscripten/C++ examples working on a demo website. I would like to do a full VTK pipeline in WebAssembly including fetching the imagedata and polydata from a URL resource. I haven’t tried it yet, but I suspect it will not work. Has anybody else tried to fetch data with the VTK C++ readers from a URL resource?

I am going to try to use emscripten fetch with the URL and then convert the result from char* to std::string. I can then set the ReadFromInputString flag to true on the vtkXMLImageDataReader and set the InputString member of the vtkXMLImageDataReader to the std::string. I will update if this works.

1 Like