[vtkusers] Trouble with offscreen rendering

Johnny Norris jnorris at mcs.anl.gov
Fri Mar 22 18:34:56 EST 2002


Hi,

Om my W2K box, I'm trying to render a series of images offscreen and write
each image to a file.  My code is something like this:

   vtkRenderWindow* win = vtkRenderWindow::New();
   win->OffScreenRenderingOn();
   win->AddRenderer(ren);

   vtkWindowToImageFilter* wtif = vtkWindowToImageFilter::New();
   wtif->SetInput(win);

   vtkImageWriter* writer = vtkBMPWriter::New();
   writer->SetInput(wtif->GetOutput());

   for (int i=0; i<NUM_FRAMES; ++i) {
      // Do stuff to change image.

      win->Render();
      wtif->Update();
      writer->SetFileName("something unique.bmp");
      writer->Write();
   }

   win->RemoveRenderer(ren);
   win->Delete();
   wtif->Delete();
   writer->Delete();

The resulting images are all just gray rectangles.  This code worked fine
under VTK 3.2 with vtkWin32OffScreenRenderWindow.  It works now if I comment
out the call to OffScreenRenderingOn(), so I'm pretty sure that the
problem isn't with the filter or the writer.

Any suggestions?

Thanks,
John
-- 
John Norris
Research Programmer
Center for Simulation of Advanced Rockets
http://www.uiuc.edu/ph/www/jnorris



More information about the vtkusers mailing list