I am drawing a 3D scene and some 2D slices of the scene on separate windows. If I try to render the full scene into a vectorized image with vtkExporterGL2PS, the output comes with invalid utf-8 characters that break the xml of the .svg files. The 2D slices, however, are properly rendered, but I am using VTK 6.3 and I’ve read that porting 3D things won’t be available in future versions, requiring a vtkcontext2D. To do the trick.
I’ve been unable to find any guide or example on the vtkDocumentation about how to use it, and I have some questions.
I guess that porting a 3D scene into a 2D context is out of the question, but how can I draw simple shapes in a context2D ?
I also had a hard time figuring out how to make use of this part of VTK api. One place to get started is to look through the tests in Rendering/Context2D/Testing/, where you’ll find some Python and C++ tests exercising some of the api. To draw simple shapes, I think the best (maybe only?) approach is to define a new subclass of vtkContextItem and override the Paint method, which receives as argument a pointer to a vtkContext2D object you can use to draw all kinds of primitives, see the documentation of the vtkContext2D class here . See Rendering/Context2D/Testing/Cxx/TestContext2D.cxx for a simple example of that approach.
Hope this helps.
Thanks! I’ll look into those