[vtkusers] problem rendering

Emiliano Beronich emiliano at veccsa.com
Fri Aug 20 15:19:54 EDT 2004


Hi Lucas!

The problem seems to be related with the destroying of the 
vtkRenderWindow. You are creating and destroying the renderwindow (and 
its resources) inside the brackets so that's why the window dissapears 
at line
renWin->Delete();

You can check this looking at the reference count of renWin. If you want 
to extend the life of the window, you have to delay the destruction of 
renWin.

HTH
Emiliano


Lucas Lorenzo wrote:

> Hi all,
> 
> I'm trying to run this simple code (I'm pasting only the important parts):
> 
> 
> .
> .
> .
> 
> / // Create the RenderWindow, Renderer and both Actors
> vtkRenderer *ren1 = vtkRenderer::New();
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer(ren1);
> 
> // Add the actors to the renderer, set the background and size
> ren1->AddActor(imActor);
> renWin->SetSize(640,640);
> 
> // render the image
> vtkCamera *cam1 = ren1->GetActiveCamera();
> cam1->Zoom(2.5);
> renWin->Render();
> 
> // deallocate memory:
> image_reader->Delete();
> lut->Delete();
> get_slice->Delete();
> im_mapper->Delete();
> imActor->Delete();
> ren1->Delete();
> renWin->Delete();
> 
> return 0;
> }
> /
> The problem I have is that the window pops up, shows the image I want to 
> render but then immediately it closes.
> What am I missing so that the renderer window doesn't close ?
> Thanks,
> 
> Lucas
> 
> 
> Lucas Lorenzo
> 
> University of Utah
> Nora Eccles Harrison CardioVascular Research and Training Institute
> Fellows Room
> 95 South 2000 East
> Salt Lake City, UT 84112-5000
> 
> e-mail: lucas at cvrti.utah.edu
> telephone: 801-587-9536
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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