[vtkusers] vtkWindowToImageFilter
Dominik Szczerba
domi at vision.ee.ethz.ch
Tue Apr 3 16:36:09 EDT 2007
I am not sure if this has really anything to do with VTK. I have a commercial
program that does the same thing when taking screenshots. I recall now that
disabling DRI removed this effect indicating problems with the driver. I
would disable DRI in your case just for a test.
bye
Dominik
On Tuesday 03 April 2007 22:23, you wrote:
> Hi Dominik,
>
> That's the problem - if any part of the render window is overlapped,
> or just off screen rendering is on, I'll get an incorrect image.
>
> As far as I can tell, there is no way to do this at the moment. How
> are other people doing this? I could try using vtkGL2PSExporter as you
> suggested but it might be too slow to do quick screen captures.
>
> Thanks,
> Mark
>
> On 4/3/07, Dominik Szczerba <domi at vision.ee.ethz.ch> wrote:
> > With a png file the covered of off-desktop part will be empty.My code:
> >
> > vtkSmartPointer<vtkPNGWriter> writer =
> > vtkSmartPointer<vtkPNGWriter>::New(); w2i->Update();
> > writer->SetInputConnection(w2i->GetOutputPort());
> > writer->SetFileName((curr_fname+".png").c_str());
> > renWin->Render();
> > writer->Write();
> > w2i->Modified(); //w2i is a global
> >
> > BTW. The effect of vtkGL2PSExporter will always be OK.
> > Dominik
> >
> > On Tuesday 03 April 2007 21:21, Mark Wyszomierski wrote:
> > > 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
> >
> > --
> > 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
More information about the vtkusers
mailing list