[vtkusers] Off-screen rendering inconsistency if window center is changed

Lasso, Andras (GE Healthcare) Andras.Lasso at med.ge.com
Wed Jan 24 05:28:16 EST 2007


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);
...
}



More information about the vtkusers mailing list