DirectX vs OpenGL matrix math?

Hi,

I have these lines of OpenGL code, that I need to port to DirectX. I have no choice in doing this or not. So, could anybody help me out with what the DirectX code would look like for the case below?


double gl_vector[16];

// R[3][3] is a rotation matrix, right-hand coordinate system, column major. T[3] is the translation vector (x, y, z).

gl_vector[04+0] = R[0][0]; gl_vector[04+1] = R[1][0]; gl_vector[04+2] = R[2][0]; gl_vector[04+3] = 0.;
gl_vector[14+0] = R[0][1]; gl_vector[14+1] = R[1][1]; gl_vector[14+2] = R[2][1]; gl_vector[14+3] = 0.;
gl_vector[24+0] = R[0][2]; gl_vector[24+1] = R[1][2]; gl_vector[24+2] = R[2][2]; gl_vector[24+3] = 0.;
gl_vector[34+0] = T[0]; gl_vector[34+1] = T[1]; gl_vector[34+2] = T[2]; gl_vector[34+3] = 1.;

glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(gl_vector);
glEnable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT);
glutSolidTeapot(100);

How can I take the exact same values of R and T and position an object in (left-handed) DirectX at the proper/same location as in OpenGL?

R and T are given to me by an external tool (like a mechanical arm), so I can’t control how they are calculated. I just have the values.

Thanks a lot :slight_smile: