<div dir="ltr">have a look here<br><br><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CloseWindow">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CloseWindow</a><br><br>Simplying pressing &quot;Q&quot; closes the window, so have check in the source code of vtkRenderWindow what it invokes when pressing that key.<br>
<br>Jothy<br><br><div class="gmail_quote">On Mon, Jun 18, 2012 at 1:55 PM, sameermg <span dir="ltr">&lt;<a href="mailto:sameer.gaikwad11@gmail.com" target="_blank">sameer.gaikwad11@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi all,<br>
<br>
I am learning VTK. I would like to know if there is a way to close the VTK<br>
window before an application exits. I&#39;ve tried Delete, Finalize,<br>
TerminateApp and SetRenderWindow(NULL), but none of these functions seem to<br>
work until I the application exists. Am I missing something here? I am<br>
posting sample code below:<br>
<br>
int main(int, char *[])<br>
{<br>
<br>
  vtkSmartPointer&lt;vtkRenderer&gt; renderer =<br>
vtkSmartPointer&lt;vtkRenderer&gt;::New();<br>
  vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow =<br>
vtkSmartPointer&lt;vtkRenderWindow&gt;::New();<br>
  renderWindow-&gt;AddRenderer(renderer);<br>
  vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; renderWindowInteractor =<br>
vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();<br>
  renderWindowInteractor-&gt;SetRenderWindow(renderWindow);<br>
   renderWindow-&gt;Render();<br>
  renderWindow-&gt;SetWindowName(&quot;First Window&quot;);<br>
  renderWindowInteractor-&gt;Start();<br>
<br>
  // Close the window<br>
  renderWindowInteractor-&gt;GetRenderWindow()-&gt;Delete();<br>
<br>
  // Stop the interactor<br>
  renderWindowInteractor-&gt;TerminateApp();<br>
<br>
  while(1); //Window does not close because of this while(1). It just<br>
freezes<br>
               //If I remove while(1), application exits and window gets<br>
closed automatically.<br>
              //I&#39;ve tried using Delete,Finalize,TerminateApp &amp;<br>
SetRenderWindow(NULL) before while(1), but no call closes the  window<br>
<br>
  return EXIT_SUCCESS;<br>
}<br>
<br>
Any help is highly appreciated. Thanks for your time.<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Closing-VTK-window-before-application-exits-tp5713966.html" target="_blank">http://vtk.1045678.n5.nabble.com/Closing-VTK-window-before-application-exits-tp5713966.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<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>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu Selvaraj<br>PhD Student<br>University of Liverpool<br>UK<br></div><br>
</div>