[vtkusers] Closing VTK window before application exits
sameermg
sameer.gaikwad11 at gmail.com
Mon Jun 18 08:55:21 EDT 2012
Hi all,
I am learning VTK. I would like to know if there is a way to close the VTK
window before an application exits. I've tried Delete, Finalize,
TerminateApp and SetRenderWindow(NULL), but none of these functions seem to
work until I the application exists. Am I missing something here? I am
posting sample code below:
int main(int, char *[])
{
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindow->Render();
renderWindow->SetWindowName("First Window");
renderWindowInteractor->Start();
// Close the window
renderWindowInteractor->GetRenderWindow()->Delete();
// Stop the interactor
renderWindowInteractor->TerminateApp();
while(1); //Window does not close because of this while(1). It just
freezes
//If I remove while(1), application exits and window gets
closed automatically.
//I've tried using Delete,Finalize,TerminateApp &
SetRenderWindow(NULL) before while(1), but no call closes the window
return EXIT_SUCCESS;
}
Any help is highly appreciated. Thanks for your time.
--
View this message in context: http://vtk.1045678.n5.nabble.com/Closing-VTK-window-before-application-exits-tp5713966.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list