<div dir="ltr">Hi guys,<div>Yestarday i was able to get the code ReadSTL from VTK Wiki and convert to use in my QtApp using QVTKWidget. But, this class is depreciade. So i'm trying to use the QVTKWidget2.</div><div>Was told to me that i only need to this to make the code fom VTK Wiki works on my code:</div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">vtkRenderWindow</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">renderWindow</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderWindow</span><span style="color:rgb(0,0,0)">();</span></pre>Using the class QVTKWidget the return of GetRenderWindow is the type vtkRenderWindow, so its easy to solve. But in the QVTKWidget2, the return type of the function is a vtkGenericOpenGLRenderWindow, so with a little help for other guy i came to this:</div><div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px">
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkRenderer</span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">renderer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkRenderer</span><span style="color:rgb(0,0,0)">>::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">vtkRenderWindowInteractor</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">r</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderWindow</span><span style="color:rgb(0,0,0)">()-></span><span style="font-style:italic;color:rgb(0,0,0)">GetInteractor</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">vtkRenderWindow</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">renderWindow</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkRenderWindow</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">r</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetRenderWindow</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">renderWindow</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">renderWindow</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">AddRenderer</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">renderer</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">renderer</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">AddActor</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">actor</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">renderer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetBackground</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,128)">.0</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">.5</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Background</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">color</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">green</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">renderer</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">ResetCamera</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">renderWindow</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">Render</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre>BUT, the stl is load on a popup window, and dont permit zoom or move the load model . I guess that i'm missing something. But how i have only 2 days working with VTK, i dont know. I think that is something small and stupid, but i can be wrong too.</div><div>Any tips?</div><div>Thanks! </div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">__<div><b>Lays Rodrigues</b></div><div><b>Developer Front-End at Br-Print3D Project</b></div><div><b>Student of Computer Science at UFF/PURO</b></div><div>Organizadora da Semana da Computação UFF-PURO</div><div><a href="http://www.facebook.com/semanacomputacaopuro" target="_blank">www.facebook.com/semanacomputacaopuro</a></div><div><a href="http://www.facebook.com/brprint3d" target="_blank">www.facebook.com/brprint3d</a><br></div><div><br></div><div><br></div><div><br></div></div></div></div></div>
</div></div>