(I want to correct my own post here, because, as this thread has shown, things I say in the distant past stick around in search engines forever...)

On 9/15/2011 2:33 PM, Paul Martz wrote:
The OpenGL FFP projection matrix transforms from eye coordinates into clip coordinates. Those two coordinate systems are defined in the spec (see section 2.11 / figure 2.6 in the 2.1 spec). +x = right, +y = up, +z = into the screen, and eye = origin are already the eye coordinate definition prior to transform by the projection matrix.

This is wrong on two points.

1. A close read of the spec shows that it doesn't actually define these coordinate systems, and where the +y = up convention comes from might be a good topic for discussion in the OpenGL forums. I'm sure I knew the full story back in 1994, but it's lost in the fog of my memory. Perhaps it stems from simple Cartesian math: origin in lower-left corner of the window, +x = right, +y = up, and everything else is inferred from back-transforming.

(Regardless, I still think the getLookAt code is correct, as it is just performing the inverse of osg::Matrix::lookat.)

2. The projection matrix usually performs a negative scale on z, to support right-handed world coordinates in conjunction with a +z = into the screen depth buffer convention. So I was wrong about eye coordinates above. Eye coordinates generally have -z = into the screen, not +z. The projection performs a negative scale on z, producing clip coordinates with +z = into the screen. I don't see where the spec actually prohibits setting up a different convention, though. Again, it might just be implicit in the math.
   -Paul

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to