[vtk-developers] Stage one of Initialize/Deinitialize patches to RenderWindows everywhere
Charl P. Botha
c.p.botha at ewi.tudelft.nl
Wed Jul 23 09:13:13 EDT 2003
Dear developers,
I have just committed the first batch of patches implementing the
symmetrical Initialize() and Deinitialize() methods for RenderWindows
that I discussed a few months back.
I have implemented these calls so far in vtkXOpenGLRenderWindow,
vtkWin32OpenGLRenderWindow and vtkWinCEOpenGLRenderWindow. The idea is
that they can be called multiple times: Deinitialize() shuts down all
system-specific rendering resources (windows, displays, gl contexts,
etc) and does SetRenderWindow(NULL) on all Renderers. Initialize() does
the reverse: these two methods are symmetric. All existing code remains
functional.
My request is that the MacOS-X developers perform the same changes in
vtkCarbonRenderWindow and vtkCocoaRenderWindow, as Initialize() and
Deinitialize() are to become abstract calls in the vtkRenderWindow
interface.
The idea behind this is that there is a reliable way to make sure that a
RenderWindow() is not using any system resources. This solves the
age-old VTK problem of Widget destruction vs vtkRenderWindow reference
counting in widget set-VTK combinations. The widget writer can simply
call Deinitialize() on the encapsulated RenderWindow and rest assured
that his application won't die a horrible death when he destroys the
enclosing widget.
In addition, the WindowRemap implementation becomes trivial for all
RenderWindows:
// shut everything down
this->Deinitialize();
// set the default windowid
this->WindowId = this->NextWindowId;
this->NextWindowId = (Window)NULL;
// set everything up again
this->Initialize();
I chose to use the name "Deinitialize" instead of the suggested
"Finalized" simply because "finalized" implies a once-off and final
action, whereas the initialize/deinitialize pair can be called multiple
times in the life-time of a RenderWindow.
Thanks,
Charl
ps. Benoit, I've cc'ed you, because the changes I've made so far should
already solve your disappearing actor at reparent bug.
--
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
More information about the vtk-developers
mailing list