[ODE] GeomRotation -> OpenGL

Daniel K. O. danielko.listas at gmail.com
Fri Nov 17 19:48:30 MST 2006

mal content escreveu:
> I don't quite understand how to use the information returned by
> dGeomGetRotation() to translate to glRotatef() calls.
The easiest way is to get the rotation/translation values and create an 
OpenGL matrix; then you just glMultMatrix().

Something like:

        const dReal* rot = dGeomGetRotation(...);
        const dReal* pos = dGeomGetPosition(...);

        GLfloat mat[16] = {
                            rot[0],  rot[4], rot[8], 0,
                            rot[1],  rot[5], rot[9], 0,
                            rot[2],  rot[6], rot[10], 0,
                            pos[0], pos[1], pos[2], 1


See DrawStuff code for more details and correctness (I don't remember if 
the code above is correct).

Daniel K. O.

More information about the ODE mailing list