Some classes are more special than others. :-) vtkRenderWindow subclasses depend on the graphics factory to create the "correct" subclass when vtkRenderWindow::New is called. Therefore, to add to the vtkRenderWindow hierarchy, you need to modify the graphics factory or provide your own "New" implementation that bypasses the graphics factory.<br>
<br>Modifying the graphics factory directly has the benefit of creating your specific subclass even if client applications use "vtkRenderWindow::New" in their source code...<br><br>HTH,<br>David<br><br><br><div class="gmail_quote">
On Tue, Apr 8, 2008 at 4:07 PM, Christian Banks <<a href="mailto:cryo80home@yahoo.com">cryo80home@yahoo.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>Hello,<br>I am looking for an example or some general comments, how I can extend the vtkOpenGLRenderWindow for a very special OpenGL library (vtkXOpenGLRenderWindow is not applicable, because I want to run VTK on an embedded system with a custom window system).<br>
<br>Currently I am more or less duplicating vtkXOpenGLRenderWindow with changes where necessary to account for the window system that replaces X11. Compilation of the new class vtkNewOpenGLRenderWindow is successful.<br><br>
Unfortunately the following call in a VTK application always results in renWin being a vtkXOpenGLRenderWindow, not the desired vtkNewOpenGLRenderWindow:<br><br>vtkRenderWindow *renWin = vtkNewOpenGLRenderWindow::New();<br>
<br>The reason is that New() is inherited from vtkRenderWindow::New(), which calls
vtkGraphicsFactory::CreateInstance("vtkRenderWindow") which finally executes "return vtkXOpenGLRenderWindow::New();".<br><br>Is it necessary to dig through the vtkRenderWindow hierarchy and replace each occurrence of vtkXOpenGLRenderWindow with vtkNewOpenGLRenderWindow?<br>
Or is there a way with less modifications of the vtk sources, for example overriding vtkNewOpenGLRenderWindow::New(), but how does it have to look like? I found that I cannot simply ignore the chain of calls down to vtkGraphicsFactory::CreateInstance(), but on the other hand my impression is that it is unnecessarily complicated if I have to modify several classes if all I want is to derive from vtkOpenGLRenderWindow.<br>
<br>Any comments are appreciated!<br><br>Thank you in advance<br>cryo<br></div></div><br>
<hr size="1">You rock. That's why Blockbuster's offering you <a href="http://us.rd.yahoo.com/evt=47523/*http://tc.deals.yahoo.com/tc/blockbuster/text5.com" target="_blank">one month of Blockbuster Total Access</a>, No Cost.</div>
<br>_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br>