<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 "Q" 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"><<a href="mailto:sameer.gaikwad11@gmail.com" target="_blank">sameer.gaikwad11@gmail.com</a>></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'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<vtkRenderer> renderer =<br>
vtkSmartPointer<vtkRenderer>::New();<br>
vtkSmartPointer<vtkRenderWindow> renderWindow =<br>
vtkSmartPointer<vtkRenderWindow>::New();<br>
renderWindow->AddRenderer(renderer);<br>
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br>
vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
renderWindow->Render();<br>
renderWindow->SetWindowName("First Window");<br>
renderWindowInteractor->Start();<br>
<br>
// Close the window<br>
renderWindowInteractor->GetRenderWindow()->Delete();<br>
<br>
// Stop the interactor<br>
renderWindowInteractor->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've tried using Delete,Finalize,TerminateApp &<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>