[vtkusers] bug with multiple render windows?
Frank Broicher
broicher at techinfo.rwth-aachen.de
Tue Feb 25 05:11:50 EST 2003
Thank you John, that was the right hint!!!!
The program below does not produce memory leaks anymore.
//////////////////////////////////////////////
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>
#include <vtkActor.h>
#include <vtkPolyDataMapper.h>
int main ()
{
vtkRenderWindow * renWin = vtkRenderWindow::New ();
vtkRenderWindow * renWin2 = vtkRenderWindow::New ();
vtkRenderer * ren1 = vtkRenderer::New();
vtkRenderer * ren2 = vtkRenderer::New();
vtkSphereSource *sphere;
vtkPolyDataMapper *map;
vtkActor *aSphere;
renWin ->AddRenderer(ren1);
renWin2->AddRenderer(ren2);
sphere = vtkSphereSource::New();
map = vtkPolyDataMapper::New();
map->SetInput(sphere->GetOutput());
////////////////////////////////
/// And here is the solution ///
////////////////////////////////
map->GlobalImmediateModeRenderingOn();
aSphere = vtkActor::New();
aSphere->SetMapper(map);
ren1->AddActor(aSphere);
ren2->AddActor(aSphere);
while (1)
{
renWin ->Render();
renWin2->Render();
}
}
//////////////////////////////////////////////
--
Dipl.-Inform. F. H. Broicher
Chair of Technical Computer Science Lehrstuhl f. Technische Informatik
RWTH Aachen University RWTH-Aachen
Ahornstraße 55, Room 2226
D-52074 Aachen
------------------------------------------------------------------------
Tel.: +49 (241) 80 23636 mailto:broicher at techinfo.rwth-aachen.de
Fax.: +49 (241) 80 22308 mailto:frank.broicher at ieee.org
------------------------------------------------------------------------
Fate, it seems, is not without a sense of irony. (Morpheus, The Matrix)
More information about the vtkusers
mailing list