[vtkusers] PolyDataMapper Painter
Marcus D. Hanwell
marcus.hanwell at kitware.com
Mon Aug 18 14:24:03 EDT 2014
On Fri, Aug 15, 2014 at 4:14 PM, Nil Goyette <nil.goyette at imeka.ca> wrote:
>
> Hi all,
>
> I'm working with brain fibers (lines in a vtkPolyData) and I need to filter some fibers as fast as I can. Creating a new vtkPolyData or any trick like that is out of the question; I tested and it's too slow. I concluded that creating any kind of of data will always be too slow.
>
> I successfully modified the vtkPolyDataMapper to draw only a specified set of cells. It's working perfectly, in real-time. I tried to do the same with the 2D views (I'm working in MITK, but the vtkPolyDataMapper is the important part here) and I discovered something dark and complex: the painter. I read some articles [1, 2] to understand it what's going on. I think I get it, but I still have a question for you.
>
The painters are in the process of being deprecated, and the new
OpenGL 2+ rendering backend does not use painters for rendering.
> I want to create my own vtkLinesPainter (mostly to add a std::set<vtkIdType>* and rewrite vtkDrawPrimsMacro). This is easy enough, but how do I plug this class with the rest of the Painter architecture? Who will tell vtk to use my class instead of the standard one?
You can set things in the painter pipeline, I haven't done a lot of
this but there is effectively a chain of painters and it is possible
to add your own/override them.
>
> Moreover, is there a reason why the 3D mapper is defined in the "normal" mapper files (vtkPolyDataMapper and vtkOpenGLPolyDataMapper) and the 2D mapper use a Painter concept? For example, vtkDrawPrimsMacro is in the Mapper and in the Painter. Is it a WIP?
The vtkOpenGLPolyDataMapper class has not been used for many years,
and has been deprecated (it has caused similar confusion in the past).
vtkPainterPolyDataMapper is the class that is used by default, you
would need to modify the overrides to change that behavior. We are
working on overhauling many aspects of the rendering in VTK, see
http://www.kitware.com/source/home/post/144 for some background on
early results there. This is not finished, and so may not have
everything you need yet. We wanted to get it out early so that people
could take a look, and give us feedback as we finish off other pieces.
Hopefully that makes things clearer.
Marcus
More information about the vtkusers
mailing list