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/GL/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/

Attachment: pgp692KJ5iaFs.pgp
Description: PGP signature

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to