[vtkusers] Closing VTK window before application exits
Jothybasu Selvaraj
jothybasu at gmail.com
Mon Jun 18 09:13:45 EDT 2012
have a look here
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/CloseWindow
Simplying pressing "Q" closes the window, so have check in the source code
of vtkRenderWindow what it invokes when pressing that key.
Jothy
On Mon, Jun 18, 2012 at 1:55 PM, sameermg <sameer.gaikwad11 at gmail.com>wrote:
>
> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
Jothybasu Selvaraj
PhD Student
University of Liverpool
UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120618/9e102aac/attachment.htm>
More information about the vtkusers
mailing list