How to make a subclass of vtkRenderer?

Hi teams,

I want to make a subclass of vtkRenderer, but it does not work.
Even if I only change the vtkRenderer to “myRnderer”.
I searched for hours but I can only get the information of "how to make a subclass of vtkActor ", but I got a message here “some macro and function should be override explicitly”.
Hence, I tried to copy the code of vtkOpenGLRenderer, and know which part should be kept, but I failed to compile it.

So I want to know how can I override vtkRenderer? Which function and macro should be used?

VTKRENDERINGCORE_EXPORT // I can not compile with that macro sucessfully.
    vtkTypeMacro(VTKMRenderer, vtkRenderer)
    void PrintSelf(ostream& os, vtkIndent indent) override;
   friend class vtkRenderPass;
///
vtkStandardNewMacro(VTKMRenderer)

Thank you!

Best regards.

Hi, Wailmer,

Here’s how I subclass a VTK class (in this case, the vtkInteractorStyleTrackballCamera class):

In the .h:

#include <vtkInteractorStyleTrackballCamera.h>

(...)

class myMouseInteractor : public vtkInteractorStyleTrackballCamera
{
public:

    static myMouseInteractor* New();

    vtkTypeMacro(myMouseInteractor, vtkInteractorStyleTrackballCamera)
   
    (...)

}

In the .cpp

#include <vtkObjectFactory.h>

(...)

// Implementation of the New() function for myMouseInteractor.
vtkStandardNewMacro(myMouseInteractor);

(...)

I hope this helps,

Paulo