<div dir="ltr">

















<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 0);" lang="EN-GB">I use </span>
vtkStandardNewMacro to add New macro. The problem is that I got 5 link errors even if I include the librairies of VTK (In VS 8).</p>Hereby, you find my derived class (.h &amp; .cxx).<br><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">---------------- </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">vtkMyDerivedProp.h -------------------------<br>
</span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">#ifndef</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB"> __vtkMyDerivedProp_h<br>
#define</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB"> __vtkMyDerivedProp_h<br>#include</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB"> <span style="color: maroon;">&quot;vtkProp.h&quot;</span><br>
<br>class</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB"> VTK_RENDERING_EXPORT vtkMyDerivedProp : <span style="color: blue;">public</span> vtkProp<br>{<br>public</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">:</span></p>








<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"><span style=""></span>&nbsp; vtkTypeRevisionMacro(vtkMyDerivedProp,vtkProp);<br><span style="">&nbsp; </span><span style="color: blue;">void</span> PrintSelf(ostream&amp; os, vtkIndent indent);<br>
<span style="">&nbsp; </span><span style="color: blue;">static</span> vtkMyDerivedProp* New();</span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">protected</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">:</span></p>






<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"><span style="">&nbsp;
</span>vtkMyDerivedProp();<br><span style="">&nbsp; </span>~vtkMyDerivedProp();</span></p>



<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">private</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">:</span></p>






<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"><span style="">&nbsp;
</span>vtkMyDerivedProp(<span style="color: blue;">const</span>
vtkMyDerivedProp&amp;);<span style="">&nbsp; </span><span style="color: blue;">// Not implemented.&nbsp;&nbsp; <br>&nbsp; void</span> <span style="color: blue;">operator</span>=(<span style="color: blue;">const</span> vtkMyDerivedProp&amp;);<span style="">&nbsp; </span><span style="color: green;">// Not implemented.</span></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">};</span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">#endif</span><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"></span></p>


<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">---------------- </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">vtkMyDerivedProp.cxx -------------------------</span>

<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">#include</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"> <span style="color: maroon;">&quot;vtkMyDerivedProp.h&quot;</span></span></p>


<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">#include</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"> <span style="color: maroon;">&quot;vtkObjectFactory.h&quot;</span></span></p>




<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">vtkCxxRevisionMacro(vtkMyDerivedProp, <span style="color: maroon;">&quot;$Revision: 1.36 $&quot;</span>);</span></p>




<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">vtkStandardNewMacro(vtkMyDerivedProp);</span></p>











<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">vtkMyDerivedProp::vtkMyDerivedProp(){}<br></span></p>



<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">vtkMyDerivedProp::~vtkMyDerivedProp(){}</span></p>









<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">void</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> vtkMyDerivedProp::PrintSelf(ostream&amp; os, vtkIndent
indent)<br>{<br><span style="">&nbsp;</span><span style="color: blue;">this</span>-&gt;Superclass::PrintSelf(os,indent);<br>}</span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">-------------------------------------- Errors </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;" lang="EN-GB">------------------------------------------</span><br>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"></span></p>

<p class="MsoNormal" style=""><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"><b>I got 5 errors </b><br></span></p><p class="MsoNormal" style=""><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">1&gt;vtkMyDerivedProp.obj : error LNK2001: unresolved
external symbol &quot;private: virtual char const * __thiscall
vtkMyDerivedProp::GetClassNameInternal(void)const &quot;
(?GetClassNameInternal@vtkMyDerivedProp@@EBEPBDXZ)</span></p>



<p class="MsoNormal" style=""><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">1&gt;vtkMyDerivedProp.obj : error LNK2001: unresolved
external symbol &quot;public: virtual int __thiscall vtkMyDerivedProp::IsA(char
const *)&quot; (?IsA@vtkMyDerivedProp@@UAEHPBD@Z)</span></p>



<p class="MsoNormal" style=""><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">1&gt;vtkMyDerivedProp.obj : error LNK2001: unresolved
external symbol &quot;protected: virtual class vtkObjectBase * __thiscall
vtkMyDerivedProp::NewInstanceInternal(void)const &quot;
(?NewInstanceInternal@vtkMyDerivedProp@@MBEPAVvtkObjectBase@@XZ)</span></p>



<p class="MsoNormal" style=""><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">1&gt;vtkMyDerivedProp.obj : error LNK2019: unresolved
external symbol &quot;__declspec(dllimport) const
vtkMyDerivedProp::`vftable&#39;&quot; (__imp_??_7vtkMyDerivedProp@@6B@) referenced
in function &quot;protected: __thiscall
vtkMyDerivedProp::vtkMyDerivedProp(void)&quot; (??0vtkMyDerivedProp@@IAE@XZ)</span></p>



<p class="MsoNormal"><span style="font-size: 8pt; font-family: &quot;Courier New&quot;;">1&gt;C:\Documents and Settings\asahtari\Mes
documents\Projet\Bibillothéques\VTK\MyTest\MyLib.dll : fatal error LNK1120: 4
unresolved externals</span></p>

When I put <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">vtkMyDerivedProp instead of </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">vtkProp3D, it compiles without any error.</span><br>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">I don&#39;t understand .Is it a</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"> matter of</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">VTK </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;" lang="EN-GB">librairies ? Please Help!<br>
<br></span>Amine<br><br><div class="gmail_quote">2008/8/14 Utkarsh Ayachit <span dir="ltr">&lt;<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>&gt;</span><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></div><div class="Wj3C7c">Please keep the questions to the mailing list, so that others can<br>
benefit/contribute as well.<br>
<br>
To add New():<br>
* take a look at any concrete class in VTK eg. vtkCollection (the New is<br>
&nbsp;declared in the header and defined using<br>
vtkStandardNewMacro(vtkCollection); in the cxx.<br>
<br>
* not using the viewport in the RenderOpaqueGeometry should not be a<br>
problem. It&#39;s only provided if needed.<br>
<br>
Utkarsh<br>
<br>
<br>
<br>
<br>
Mohammed Amine SAHTARI wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thank you very much Utkarsh.<br>
<br>
I am tring to implement your solution but I have some problems.<br>
<br>
1) I create vtkMyDerivedProp.h and vtkMyDerivedProp.cxx<br>
<br>
&nbsp;I subclass vtkProp :<br>
 &nbsp; &nbsp; &nbsp; - I copy the class code of vtkProp3D (.h and .c files)<br>
 &nbsp; &nbsp; &nbsp; - I replace all the words :<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkProp3D /by/ /vtkMyDerivedProp /and Prop3D by /MyDerivedProp/<br>
 &nbsp; &nbsp; &nbsp; - I include /&quot;vtkGl.h&quot;/ in vtkMyDerivedProp.h<br>
 &nbsp; &nbsp; &nbsp; - I add RenderOpaqueGeometry() in vtkMyDerivedProp.h like this :<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /virtual int RenderOpaqueGeometry(vtkViewPort* )<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {/<br>
<br>
/ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glBegin (GL_LINES);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex2f (-2.5, 2.5);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex2f (2.5, -2.5);<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glEnd ();/<br>
<br>
/ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }/<br>
<br>
2) In my program : &nbsp;<br>
&nbsp;- I include and instantiate vtkMyDerivedProp :<br>
<br>
 &nbsp; &nbsp;/ &nbsp;//# include &quot;vtkMyDerivedProp.h&quot;<br>
 &nbsp; &nbsp; &nbsp;vtkMyDerivedProp *MyDerivedProp;/<br>
<br>
- &nbsp; &nbsp; &nbsp; &nbsp; I use &nbsp;vtkMyDerivedProp :<br>
<br>
/ &nbsp; &nbsp; vtkRenderer &nbsp;*renderer = vtkRenderer &nbsp;::New();/<br>
<br>
/ &nbsp; &nbsp; &nbsp;vtkMyDerivedProp-&gt; RenderOpaqueGeometry(renderer);/<br>
<br>
/ &nbsp; &nbsp; &nbsp;renderer-&gt;AddProp(vtkMyDerivedProp);/<br>
<br>
<br>
*Problem *: vtkMyDerivedProp is used without been defined!<br>
<br>
*Question 1 :* How can I define it ? &nbsp; (vtkMyDerivedProp::New() &nbsp;doesn&#39;t work)<br>
<br>
*Question 2 :* &nbsp;RenderOpaqueGeometry has vtkViewPort* in input but doesn&#39;t use it. Is it a problem ?<br>
<br>
How can I fix this?<br>
<br>
Looking forward to hear from you soon,<br>
<br>
Amine**<br>
<br>
<br>
<br>
<br>
&nbsp;<br>
<br>
2008/8/14 Utkarsh Ayachit &lt;<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a> &lt;mailto:<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@kitware.com</a>&gt;&gt;<br>

<br>
 &nbsp; &nbsp;iren-&gt;Start() results in repeated calls to renWin-&gt;Render() on<br>
 &nbsp; &nbsp;interaction. This will clear whatever you had drawn. A better<br>
 &nbsp; &nbsp;approach is to subclass vtkProp(or one of it&#39;s subclasses) and put<br>
 &nbsp; &nbsp;your rendering code in RenderOpaqueGeometry() /<br>
 &nbsp; &nbsp;RenderTranslucentPolygonalGeometry()/ RenderOverlay() etc. depending<br>
 &nbsp; &nbsp;upon what pass you want it to be rendered and then add the prop to<br>
 &nbsp; &nbsp;the renderer. That way every time the renderer re-renders, your code<br>
 &nbsp; &nbsp;will be executed.<br>
<br>
<br>
 &nbsp; &nbsp;Utkarsh<br>
<br>
 &nbsp; &nbsp;Mohammed Amine SAHTARI wrote:<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;I want to add an OpenGl code in an application of VTK.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;For this purpose, I try to draw lines using commands OpenGL.:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;*1) I add this on the top of the program :*<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;#include &lt;GL/gl.h&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;*2) I place my OpenGL commands after renWin-&gt;Render() but before<br>
 &nbsp; &nbsp; &nbsp; &nbsp;iren-&gt;Start()** : &nbsp;*<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;renWin-&gt;Render();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glBegin (GL_LINES);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;glVertex2f (-2.5, 2.5);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;glVertex2f (2.5, -2.5);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;glEnd ();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;iren-&gt;Start();<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;*But it doesn&#39;t appears.*<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;did I miss something ? How can I do this work ?<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Looking forward to hear from you soon,<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Amine<br>
<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;------------------------------------------------------------------------<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;_______________________________________________<br>
 &nbsp; &nbsp; &nbsp; &nbsp;This is the private VTK discussion list.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Please keep messages on-topic. Check the FAQ at:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp;Follow this link to subscribe/unsubscribe:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
</blockquote>
<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>
</div></div></blockquote></div><br></div>