[ODE] converting opengl matrices to ODE positions. or something!

Railey, Ken krailey at amazon.com
Fri Sep 9 16:29:22 MST 2005



GLfloat local_matrix[16];

void set_matrix (const float pos[3], const float R[12]) {
    local_matrix[0]    =     R[0];
    local_matrix[1]    =     R[4];
    local_matrix[2]    =     R[8];
    local_matrix[3]    =     0;
    local_matrix[4]    =     R[1];
    local_matrix[5]    =     R[5];
    local_matrix[6]    =     R[9];
    local_matrix[7]    =     0;
    local_matrix[8]    =     R[2];
    local_matrix[9]    =     R[6];
    local_matrix[10] =     R[10];
    local_matrix[11] =     0;
    local_matrix[12] =     pos[0];
    local_matrix[13] =     pos[1];
    local_matrix[14] =     pos[2];
    local_matrix[15] =     1;
}
        
set_matrix( dBodyGetPosition(body), dBodyGetRotation(body));
glMultMatrixf (local_matrix);


HTH
-Ken 

-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On Behalf Of Dan
Sent: Friday, September 09, 2005 4:05 PM
To: ode at q12.org
Subject: [ODE] converting opengl matrices to ODE positions. or something!

Hi this is my first post/email so I hope i'm doing it right...

I've coded a simple-ish 3D engine with a sort of scene graph structure
with each node having an opengl matrix which stores the info about
translation/rotation/scaling. Now I am trying to incorperate ODE into
this.

Now I would like to keep my original functions for translation etc
(upon the matrix) as they are relatively simple.

How would I convert the values needed for ODE position/rotating into
an opengl matrix and vice versa - to get an opengl matrix from ODE
data etc...

Or is there a better solution, would I be better off dropping the
opengl functions and just using the ODE functions. Although I would
still need to make some conversion from the ode-get-position-rotation
functions to find the opengl matrix needed to draw the objects.

I hope you understand what i'm getting at. Any help or advice will be
much appreciated!
Thanks.

_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list