[vtk-developers] parallel camera: how to get image to fill viewport?
David Gobbi
dgobbi at atamai.com
Thu Nov 17 11:14:04 EST 2005
Steve M. Robbins wrote:
>On Tue, Nov 15, 2005 at 04:11:38PM -0500, David Gobbi wrote:
>
>
>
>>3) The corners of the Viewport correspond to positions at the corners of
>>the screen pixels (note: screen pixels, not image data pixels). Display
>>coordinates correspond to positions at the center of screen pixels.
>>That is why Viewport to Display conversion involves an offset of half a
>>screen pixel.
>>
>>
>
>You're sure about that? The comment in vtkViewport.cxx method
>ViewportToNormalizedDisplay() says the opposite:
>
> // the 0.5 offset is here because the viewport uses pixel centers
> // while the display uses pixel edges.
>
>My test program, if you modify it to dump the Viewport-to-Display
>transform, outputs:
>
>Viewport-to-Display transform
>1.0 0.0 0.5
>0.0 1.0 0.5
>
>which is the correct transformation from pixel centre-based coordinates
>to pixel corner-based coordinates.
>
>
I took a good look through the vtkViewport source, and the source is on
your side.
Display coords definitely start at the lower, left corner of the lower,
left pixel of the
vtkWindow, I checked the OpenGL Programmer's Guide and this is identical
to the
definition of OpenGL framebuffer pixel coordinates.
Viewport coords start at the center of the lower, left pixel of the
vtkViewport. There
is still the issue that when multiple renderers are used per window, the
vtkViewport
boundaries don't always line up with pixel boundaries, even though the
underlying
glViewport boundaries are constrained to line up with pixel boundaries.
- David
More information about the vtk-developers
mailing list