[vtkusers] vtkWindowToImageFilter

Mark Wyszomierski markww at gmail.com
Tue Apr 3 15:21:51 EDT 2007


Hi Dominik,

That didn't seem to have any effect for me, because the bitmap is
already written out at the time writer->Write() is called.

Can I ask you though, what happens if you drag your render window
partially off your desktop screen so it gets clipped by the edges - do
you still get the entire render window contents captured? Nothing I do
seems to get around this problem. I've traced into the render window
class and it does seem to be reading the pixels from the back buffer:

    glReadBuffer(static_cast<GLenum>(this->GetBackLeftBuffer()));

still I get artifacts of overlapping windows in my screenshot!

Thanks,
Mark

On 4/3/07, Dominik Szczerba <domi at vision.ee.ethz.ch> wrote:
> I have w2i->Modified() after write, else doesnt work.
> --ds
>
> On Tuesday 03 April 2007 19:40, you wrote:
> > Hi,
> >
> > I'm using the source from the example page. Looks like:
> >
> > void CSomeClass::Screenshot(vtkRenderWindow* pRenWin)
> > {
> >     vtkWindowToImageFilter* w2i = vtkWindowToImageFilter::New();
> >     vtkBMPWriter* writer = vtkBMPWriter::New();
> >     w2i->SetInput(pRenWin);
> >     w2i->Update();
> >     writer->SetInputConnection(w2i->GetOutputPort());
> >     writer->SetFileName("C:\\test.bmp");
> >     pRenWin->Render();
> >     writer->Write();
> > }
> >
> > if the render window was doing offscreen rendering, the resulting
> > image will be just black. If doing on screen rendering, the filter
> > will just capture any other windows 'on top of' the render window. I
> > thought this filter used to capture exactly what was in the renderer,
> > regardless of what other windows were on top of it, or if it was doing
> > offscreen rendering. I know if I revert back to the VTK release
> > version the same code above works fine with offscreen rendering,
> > probably with onscreen rendering and overlapping windows?
> >
> > Thanks,
> > Mark
> >
> > On 4/3/07, Dominik Szczerba <domi at vision.ee.ethz.ch> wrote:
> > > I once had a similar problem (empty screen) and if I recall properly the
> > > solution was to call Modified() somewhere.
> > > Dominik
> > >
> > > On Tuesday 03 April 2007 15:19, Mark Wyszomierski wrote:
> > > > Hi,
> > > >
> > > > Has anyone tried using the CVS version of vtkWindowToImageFilter? It
> > > > seems to produce an empty image when used. Reverting back to the
> > > > 'release' version 5x of VTK, the same code that uses it produces
> > > > correct results. Just wondering if anyone experienced the same thing
> > > > or any ways around it,
> > > >
> > > > Thanks,
> > > > Mark
> > > > _______________________________________________
> > > > This is the private VTK discussion list.
> > > > Please keep messages on-topic. Check the FAQ at:
> > > > http://www.vtk.org/Wiki/VTK_FAQ Follow this link to
> > > > subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers
> > >
> > > --
> > > Dominik Szczerba, PhD
> > > Computer Vision Lab CH-8092 Zurich
> > > http://www.vision.ee.ethz.ch/~domi
> > > _______________________________________________
> > > This is the private VTK discussion list.
> > > Please keep messages on-topic. Check the FAQ at:
> > > http://www.vtk.org/Wiki/VTK_FAQ Follow this link to
> > > subscribe/unsubscribe:
> > > http://www.vtk.org/mailman/listinfo/vtkusers
>
> --
> Dominik Szczerba, PhD
> Computer Vision Lab CH-8092 Zurich
> http://www.vision.ee.ethz.ch/~domi
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list