[vtkusers] Extending vtkOpenGLRenderer

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Nov 13 13:52:32 EST 2018


On Tue, Nov 13, 2018 at 1:00 PM Matthew Troke <
matthew.troke at avalonholographics.com> wrote:

> I am adding a new module to VTK that extends vtkOpenGLRenderer (let's call
> it vtkMyOpenGLRenderer). I would like to be able to use this in an
> application such that when I instantiate a vtkRenderer (such as with
> vtkRenderer::New()), it creates a vtkMyOpenGLRenderer. I'm not clear on the
> correct way to set this up via CMake. Do I need to create a new backend, or
> just enable the object factory?
>

This is really just a runtime thing, and you would achieve it by
manipulating the object factory. All the CMake code does is ensure the
appropriate calls are made before any of the classes are instantiated, as
part of your application start up logic you would want to remove the
standard vtkOpenGLRenderer override, and add your own. You don't even need
this to be in a module, it just needs to derive from the vtkRenderer class
so that it is possible to return a vtkRenderer pointer from the static
::New() method.

Hope that makes sense, the entire object factory thing is runtime. We just
added convenience functions in the form of defines passed into the build
system, or calls you can add to your code that is compiled into your
application somewhere.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181113/88e66bf5/attachment.html>


More information about the vtkusers mailing list