[vtkusers] Reset scene

Budd Hirons bhiron at lsuhsc.edu
Wed Jun 25 13:29:17 EDT 2003


Not sure about a Stack Overflow, but it is essential as a general rule that 
you remove all references to other VTK objects before you destroy and 
rebuild these render objects, including inputs, outputs and observers.  I 
had difficulty doing this at one time, but the code below takes care of 
these issues for me.  My render window is used to control a client RECT of 
my main application window, I am not using MFC.

         //this->renWin->Print( cout );
         this->renWin->RemoveRenderer( this->renderer );
         this->renWin->SetInteractor( NULL );
         if( arcTag )
         {
                 //abort render callback observer
                 this->renWin->RemoveObserver( arcTag );
                 arcTag = 0;
         }

         this->renInter->Delete();
         this->renInter = NULL;

         //forces renderer to traverse its props and
         //tell them all to release window specific graphics resources
         this->renderer->SetRenderWindow( NULL );
         //removes everything that was added as a prop
         this->renderer->RemoveAllProps();

         this->renderer->Delete();
         this->renderer = NULL;

I haven't found it necessary to actually delete the renderWindow itself, 
just everything in it.
After reading some of these you might try this route as well.
http://public.kitware.com/pipermail/vtkusers/2003-February/016179.html
http://public.kitware.com/pipermail/vtkusers/2003-February/016081.html

Cheers,
Budd.

At 06:30 PM 6/25/2003 +0200, you wrote:
>Hi I'm currently developing an application using VTK with C++ under windows.
>After getting some input from a dialog I open a vtkRenderWindow and display
>some objects. Now I'd like to be able to reset the scene and display other
>objects according to certain settings I make in the dialog.
>
>Unfortunately I wasn't very successful yet. The way I tried was to delete
>the vtkRenderWindow object and the vtkRenderWindow object using their Delete()
>methods. Afterwards I tried to create new objects by calling their New()
>methods but this all results in a program crash with "stack overflow".
>
>Any help and tips would be greatly appreciated!
>
>Thanks in advance
>Chris
>
>--
>+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
>Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list