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](). The order of the operands for concatenation and vector-matrix multiplication in OSG are "backwards" from OpenGL notation. 'row' and 'col' parameters to Matrix::operator() refer to a C-style row-major 2x2 array. Thus "row 0" in an OSG matrix contains OpenGL matrix elements [ 0 1 2 3 ] (or OpenGL "column 0"). (I hope this hasn't added to the confusion? Seriously, I was trying to clarify things with this post... :-) -Paul > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jan Ciger > Sent: Friday, February 23, 2007 3:00 PM > To: osg users > Subject: Re: [osg-users] matrix multiplications and transforms > > On Friday 23 February 2007, Robert Osfield wrote: > > On 2/23/07, Paul Martz <[EMAIL PROTECTED]> wrote: > > > Robert, please correct me if I'm wrong here. I'm just getting to > > > writing > the > > > QSG section on matrices... > > > > You seem on track to me. > > > > OpenGL books do use M x v ordering vs. the OSG's v x M. > > > > OSG started off use post multiplication I guess because > that's what we > > were used to, we did discuss changing a number of years > back but there > > was non consensus on changing so we stuck with what we have. > > > > I do still wonder about changing it to be consistent with > OpenGL books. > > I think that Diggory meant the column-major vs. row-major > convention of the matrices (OpenGL is column-major, OSG is > row-major). This is indeed an easy trap for the unwary when > one starts accessing the members of the osg::Matrix classes > directly - you need to reverse everything and add a > transposition here and there if you are rewriting code to use > OSG. This could be a worthy addition to the documentation on > the osg::Matrix class. > > Regarding the use of the pre/post-multiplication terms - > Paul, please, be very explicit with what you mean in the book > you are preparing. This is frequently the source of confusion > in many books, I have seen somewhere an author say that "we > post-multiply ..." and he multiplies M . v because the vector is > *after* the matrix, instead of referring to the matrix as > Robert does. I prefer to not use these terms at all and to > write down the ordering explicitly instead in order to avoid > any confusion when lecturing or speaking to somebody. > > Regards, > > 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/
