<div dir="ltr">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?<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 3:40 PM Matthew Troke <<a href="mailto:matthew.troke@avalonholographics.com">matthew.troke@avalonholographics.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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".</div><div><br></div><div>Matt<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 3:22 PM Marcus D. Hanwell <<a href="mailto:marcus.hanwell@kitware.com" target="_blank">marcus.hanwell@kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Nov 13, 2018 at 1:00 PM Matthew Troke <<a href="mailto:matthew.troke@avalonholographics.com" target="_blank">matthew.troke@avalonholographics.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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?</div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>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.</div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="m_-2416823461048741026gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="color:rgb(0,0,0)">Matthew Troke</span></div><div><span style="color:rgb(0,0,0)">Software Engineer</span></div><div><img src="http://www.avalonholographics.com/img/logo.png" width="200" height="46"></div><div><span style="color:rgb(0,0,0)">Office: 1-709-701-0239</span></div><div><span style="color:rgb(0,0,0)">Email:</span> <a href="mailto:matthew.troke@avalonholographics.com" target="_blank">matthew.troke@avalonholographics.com</a></div></div></div></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="color:rgb(0,0,0)">Matthew Troke</span></div><div><span style="color:rgb(0,0,0)">Software Engineer</span></div><div><img src="http://www.avalonholographics.com/img/logo.png" width="200" height="46"></div><div><span style="color:rgb(0,0,0)">Office: 1-709-701-0239</span></div><div><span style="color:rgb(0,0,0)">Email:</span> <a href="mailto:matthew.troke@avalonholographics.com" target="_blank">matthew.troke@avalonholographics.com</a></div></div></div></div></div>
<br>
<span lang="EN-CA"><div><i style="background-color:rgb(255,255,255);color:red;font-family:arial,sans-serif;font-size:12.8px;font-weight:bold">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.</i></div></span>