[vtk-developers] subclass of vtkActor / automatic pipeline updating / non-virtual functions in vtkAssembly

Tim Peeters T.Peeters at tue.nl
Tue May 9 05:49:16 EDT 2006


Hi,

I wanted to create an actor which has an input, similar to 
vtkImageActor, but I use other VTK functionality internally instead of 
having a vtkOpenGLImageActor subclass to do the rendering. I cannot 
simply subclass vtkActor because then I have to implement the OpenGL 
stuff myself (well, I *can* do that but it is not the most convenient 
way of doing things in this case). So I decided to subclass vtkAssembly 
and in the new class I set up the pipeline and I add the actors that I 
use to the assembly with this->AddPart(someActor). At first sight this 
works well, except that there may be a small overhead for having an 
assembly. However, I want to make sure the input is up-to-date when 
rendering. I could do this by writing Render{Opaque,Translucent}Geometry 
functions that update the input. This is not sufficient in my case 
because the overridden functions:
   int RenderOpaqueGeometry(vtkViewport *ren);
   int RenderTranslucentGeometry(vtkViewport *ren);

are not defined as virtual in vtkAssembly.h. Thus, if I add instances of 
my class to another assembly the vtkAssembly Render*Geometry functions 
are called and not my own.

Is there a reason that these functions are not virtual in vtkAssembly? 
Maybe it is a good idea to make a vtkActor-like class that is easy to 
subclass in order to add functionality without writing an OpenGL 
subclass of that actor.

Maybe I'm making things too complicated. The easiest for me would be if 
pipeline automatically propagates updates downstream, and some update 
function is automatically called in downstream vtkAlgorithms and my own 
actor when the input changes (e.g. new filename set in the reader I use).

I hope someone can comment on this or give me some suggestions.

Regards,
Tim.



More information about the vtk-developers mailing list