[vtkusers] Extending vtkOpenGLRenderer
Matthew Troke
matthew.troke at avalonholographics.com
Tue Nov 13 14:18:35 EST 2018
I think I've figured out that the abstract New() searches all registered
object factories for an override. My question is if you have 2 modules with
object factories that override the same base object, which one wins out?
And can you ensure that a particular override gets chosen?
On Tue, Nov 13, 2018 at 3:40 PM Matthew Troke <
matthew.troke at avalonholographics.com> wrote:
> What I don't understand is how does vtkRenderer::New() know what type of
> renderer to create? Normally, this would be a vtkOpenGLRenderer, so
> something must be telling VTK to override the class type with
> vtkOpenGLRenderer. How do I tell my application to create a
> vtkMyOpenGLRenderer instead? I don't know what you mean by "manipulate the
> object factory".
>
> Matt
>
> On Tue, Nov 13, 2018 at 3:22 PM Marcus D. Hanwell <
> marcus.hanwell at kitware.com> wrote:
>
>> 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.
>>
>
>
> --
> Matthew Troke
> Software Engineer
> Office: 1-709-701-0239
> Email: matthew.troke at avalonholographics.com
>
--
Matthew Troke
Software Engineer
Office: 1-709-701-0239
Email: matthew.troke at avalonholographics.com
--
_This email and any attachments are confidential and may be privileged. Any
unauthorized use, disclosure, copying or distribution of the information
received is prohibited. If you are not the intended recipient please
contact the sender immediately by return email confirming that you have and
will delete all communications related to the email and any attachments
sent to you in error._
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181113/b713b92b/attachment.html>
More information about the vtkusers
mailing list