I agree with your post, and I think the "apparent" difference between your comments and mine (even though both are right) is explained by how the matrices are laid out in memory.
My statement was intended to declare that both OpenGL and OSG matrices are laid out the same in memory. The "10" in your translation matrix, below, is the 13th floating point value in memory, and that's true for both OpenGL and OSG. -Paul > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jan Ciger > Sent: Friday, February 23, 2007 4:29 PM > To: osg users > Subject: Re: [osg-users] matrix multiplications and transforms > > On Saturday 24 February 2007, Paul Martz wrote: > > Thanks, I will take care as I document this. I think I > understand the > > difference, but Jan and Robert please read what I have below and > > verify I've got things correct. > > > > Though OpenGL uses column-major notation, an orthonormal > basis stored > > in that matrix has axis and origin elements stored > consecutively. That > > is, the new X-axis is in elements [ 0 1 2 ], the new Y axis in > > elements [ 4 5 6 ], etc. > > > > The situation is the same in OSG: OSG does not have to > transpose its > > matrix before calling glLoadMatrix[fd](). > > Hmm, I am not sure whether I am completely following (I > didn't program raw OpenGL in a while), however the typical > case where things fail is this: > > I want to translate a point [x,y,z] by 10 units in the 'x' > direction (i.e. to the right). In OSG, the matrix and > multiplication look like: > > [x,y,z,1] * | 1 0 0 0 | > | 0 1 0 0 | > | 0 0 1 0 | > | 10 0 0 1 | > > When dealing with OpenGL, the matrix looks like: > > | 1 0 0 10 | |x| > | 0 1 0 0 | * |y| > | 0 0 1 0 | |z| > | 1 0 0 1 | |1| > > The glLoadMatrix is documented here (including the diagram): > http://www.opengl.org/documentation/specs/man_pages/hardcopy/G > L/html/gl/loadmatrix.html > > And the OSG implementation is clear from the file > src/osg/Matrix_implementation.cpp in the OSG source. > > To me it seems that you need to transpose, unless I am > missing something really obvious. The trick could be in the > way the matrices *in memory* are stored and interpreted, but > I am too fried now to think clearly about this. > > > (I hope this hasn't added to the confusion? Seriously, I > was trying to > > clarify things with this post... :-) > > -Paul > > :) > > Jan > > > -- > > Jan Ciger > GPG public key: http://www.keyserver.net/ > > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
