Remote rendering with c++ vtk as server instead of python vtk as server

Hi. I basically have a lot of c++ vtk code. I am not comfortable with python vtk and I want to continue with the c++ vtk itself for the long term use case. It is not just a temporary requirement. I know how to do remote volume rendering with python vtk with vtk.web protocols and wslink on the server side. And vtk.js on the client side.

I see here that python vtk has all this code for vtk.web, vtk.web protocols, etc.

And c++ vtk doesn’t have any of this

So, I want to know what I have to do to be able to do remote volume rendering with c++ vtk and vtk.js

  1. Do I have to re-write all the
    VTK/Web/Python/vtkmodules/web at master · Kitware/VTK · GitHub
    Code over here in c++

  2. Or is there any way to automatically generate cpp wrappers for the existing vtkmodules/web python code and the wslink server side library (which is in python)
    If so is there any simple example where vtk python code has been wrapped to c++
    Ik the other way around exists, because vtk python is just auto binding of c++ code.

Any help on this is appreciated!

Python is really the network wrapper on top of VTK/C++. If you want to be 100% in C++, you will have to create a server for doing what wslink is doing in C++. Then you may have to implement some of the protocols you mentioned before. Which would represent a lot of work.

If possible, I would suggest to create 99% of the code in C++ and wrap it in Python. Then use the Python stack to expose your C++ application to the web.


Thank you. I understood as to what you are saying. So, coming to your last part, “write 99% of the code in c++ and wrap it in python”, is there a simple example to wrap vtk c++ code to vtk python. Or are you suggesting other libraries like SWIG or boost to do the job?

If your code follow the vtk modules approach, you should get the wrapping from the vtk infrastructure. You will most likely need to compile your code with VTK, but that should not be an issue for you.

1 Like

Okay thanks

@BadCookie Do share your experience once you have completed so we can learn about it. Thank you.

1 Like

Sure :slight_smile: