[vtkusers] Off-screen rendering inconsistency if window center ischanged

Lasso, Andras (GE Healthcare) Andras.Lasso at med.ge.com
Wed Jan 31 08:44:52 EST 2007


Hi all,

I've further investigated the off-screen rendering problem with a
non-default window center.
I attach the output of the on-screen and off-screen rendering, and the
test script that generates them.

The fix is a one-line modification in vtkWindowToImageFilter.cxx. I've
updated the bug report (Bug #4139) and uploaded a patched
vtkWindowToImageFilter.cxx.

Could someone please check this problem and fix it with the proposed
patch?

thanks
Andras


-----Original Message-----
From: vtkusers-bounces+andras.lasso=med.ge.com at vtk.org
[mailto:vtkusers-bounces+andras.lasso=med.ge.com at vtk.org] On Behalf Of
Lasso, Andras (GE Healthcare)
Sent: Wednesday, January 24, 2007 11:28 AM
To: VTK Users
Subject: [vtkusers] Off-screen rendering inconsistency if window center
ischanged

Hi,
 
I've found a difference between normal rendering and off-screen
rendering results when the window center is not (0, 0).
 
It seems that renderer->GetActiveCamera()->SetWindowCenter(x,y) method
has no effect when off-screen rendering is performed by
vtkWindowToImageFilter (in VTK 5.0.2)

I suspect that it is due to a bug in void
vtkWindowToImageFilter::RequestData(...) because we read the
windowCenters (by cams[i]->GetWindowCenter(windowCenters+i*2)) but then
we don't use them for anything. Changing the
cam->SetWindowCenter(deltax,deltay); line to 
cam->SetWindowCenter(windowCenters[i*2]+deltax,windowCenters[i*2+1]+delt
ay); would solve the problem (I've performed a few tests and it seems to
work fine). See the //AL comments in the code excerpt below.

I've entered a bug report for this (Bug #4139) in December, but it seems
that noone has touched it since then. What shall I do to have this
problem investigated and fixed in an official release?

Thanks in advance.
Andras Lasso



/*======================================================================
===

  Program:   Visualization Toolkit
  Module:    $RCSfile: vtkWindowToImageFilter.cxx,v $

...

//----------------------------------------------------------------------
------
// This function reads a region from a file.  The regions extent/axes //
are assumed to be the same as the file extent/order.
void vtkWindowToImageFilter::RequestData(
  vtkInformation* vtkNotUsed( request ),
  vtkInformationVector** vtkNotUsed( inputVector ),
  vtkInformationVector* outputVector)
{
...

  // for each renderer
...
  windowCenters = new double [numRenderers*2]; ...
  for (i = 0; i < numRenderers; ++i)
    {
    aren = rc->GetNextRenderer(rsit);
    cams[i] = aren->GetActiveCamera();
    cams[i]->Register(this);
    cams[i]->GetWindowCenter(windowCenters+i*2);   //AL: window center
value is read into windowCenters[] (but then it is not used)
    viewAngles[i] = cams[i]->GetViewAngle(); ...
        cam->SetWindowCenter(deltax,deltay);        //AL:
windowCenters[] is not used in computing the new window center
        //AL: the correct computation would be:
cam->SetWindowCenter(windowCenters[i*2]+deltax,windowCenters[i*2+1]+delt
ay);
...
}
_______________________________________________
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WindowToImageFilter_shift_offscreen.png
Type: image/png
Size: 1180 bytes
Desc: WindowToImageFilter_shift_offscreen.png
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070131/6b5f251b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WindowToImageFilter_shift_onscreen.png
Type: image/png
Size: 9945 bytes
Desc: WindowToImageFilter_shift_onscreen.png
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070131/6b5f251b/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WindowToImageFilter_shift.tcl
Type: application/octet-stream
Size: 789 bytes
Desc: WindowToImageFilter_shift.tcl
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070131/6b5f251b/attachment.obj>


More information about the vtkusers mailing list