[vtkusers] Renderer::AddActor() with a subclass of vtkActor

vtk at stmoser.ch vtk at stmoser.ch
Tue Jul 15 10:19:01 EDT 2003


Hi Micha,

I first thought my problem was related to the mapper as well, but since
I instantiated that same mapper to the vtkActor (which displayed) and to
the subclassed actor (which did not), the problem was somewhere else:
I finally realized that the static ::New() methods of VTK get their job
done by factories which in turn create platform/system-dependent
instances for the requested object type. The type identification is done
using character string names ("vtkActor"). Since my subclass does have
another name it is not created correctly. Using my compiler options, a
'vtkActor' is instantiated as a 'vtkOpenGLActor' (a subclass of
vtkActor), but there is some Mesa type as well.

As an ugly quick fix I subclassed my actor from eighter the
vtkOpenGLActor or the vtkMesaActor, depending on compiler options, and
everything works just fine. The correct way to go would probably be to
provide a factory capable of creating my subclassed actor and
registering it correctly.

Stephan


On Tue, 15 Jul 2003, [iso-8859-2] micha? strzelecki wrote:

> Every Actor must have mapper if not nothig is rendered;
>
> And if you have mapper
> You must check how you managed data from it in your vtkActor class.



More information about the vtkusers mailing list