[vtk-developers] possible improvements to vtkRenderWindow

Charl P. Botha c.p.botha at its.tudelft.nl
Tue Apr 8 10:30:43 EDT 2003


Dear developers,

As many of you know, the combination of a vtkRenderWindow and a widget
set can be problematic due to the differing philosophies of reference
counting and on-demand destruction.  In general, the widget set allows
one to close a window on demand.  A vtkRenderWindow that has its
WindowInfo/Id set does not.

My proposition is to add two abstract methods to vtkRenderWindow() that
will solve this problem and make vtkRenderWindow classes far more
symmetric.

At the moment, most RenderWindow specializations have an Initialize
method where all system specific initialisation is done: allocation of
window, display and a rendering context.  However, all deallocation is
done in the destructor, which is not terribly symmetric.

I would like to move Initialize() up to the vtkRenderWindow base class
and add another method called DeInitialize().  You guessed it, all
system specific initialisation is performed in Initialize() and
deinitialisation in DeInitialize().  This has three advantages:

1. On-demand destruction becomes possible in all vtkRenderWindow ->
widget set combinations: simply call DeInitialize() before destroying
the container window.
2. The system specific initialisation/deinitialisation becomes
symmetric.
3. WindowRemap() and the destructors are refactored: at the moment the
deinitialisation code is duplicated between these two.

If there are no problems with this, I would like to make the changes. 
Obviously, I'll show the patches here first so that they can be
reviewed.

Thanks,
Charl

-- 
charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/



More information about the vtk-developers mailing list