[vtkusers] Help subclassing a vtkActor

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Jul 26 13:14:45 EDT 2004


Alex,

	The factory will create either a OpenGLActor or MesaActor depending of 
your code. Try subclassing them instead.

HTH
Mathieu

Alex Lear wrote:
> I am trying to subclass a vtkActor but it doesn't appear to be working
> when I try to use my class.   The actor is not showing up in the
> renderer when I change from vtkActor to my class, viewerActor.  The
> header and source files are below.
> 
> Thanks for any help.
> Alex
> 
> 
> HEADER FILE:
> 
> #ifndef __viewerActor_h
> #define __viewerActor_h
> 
> #include "vtkActor.h"
> 
> class VTK_RENDERING_EXPORT viewerActor : public vtkActor
> {
> public:
>   static viewerActor *New();
>   vtkTypeMacro(viewerActor,vtkActor);
> 
> protected:
>   viewerActor();
>   ~viewerActor();
> 
> private:
> 
> };
> #endif
> 
> 
> 
> 
> C++ SOURCE FILE:
> 
> #include "viewerActor.h"
> #include "vtkActor.h"
> 
> viewerActor::viewerActor()
> {
> cout << "VIEWER ACTOR CREATED" << endl;
> }
> 
> viewerActor::~viewerActor()
> {
> }
> 
> viewerActor* viewerActor::New()
> {
>   return new viewerActor;
> }
> 
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 






More information about the vtkusers mailing list