[ODE] GeomRotation -> OpenGL

mal content artifact.one at googlemail.com
Sat Nov 18 06:40:05 MST 2006


On 18/11/06, Daniel K. O. <danielko.listas at gmail.com> wrote:
> 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
>         };
>
>         glMultMatrixf(mat);
>
> See DrawStuff code for more details and correctness (I don't remember if
> the code above is correct).
>

Ah, yes, that certainly looks simpler than the horrors I was putting together
with rotation functions...

cheers!
MC


More information about the ODE mailing list