1

I have an application which uses openGL and i have to port it to DirectX. To sum up my issue : How can I port a rotation matrix based on a right-handed coordinate system to a left-handed coordinate system ?

This is what i found on MSDN:

  • Flip the order of triangle vertices so that the system traverses them clockwise from the front. In other words, if the vertices are v0, v1, v2, pass them to Direct3D as v0, v2, v1.

  • Use the view matrix to scale world space by -1 in the z-direction. To do this, flip the sign of the _31, _32, _33, and _34 member of the D3DMATRIX structure that you use for your view matrix.

This works fine except I cannot flip easily my vertices because I got an 3D model from CATIA which is not a primitive, so I can't use it.

(I'm aware of row-major and column-major difference, it does not matter)

Do you know how I can port my rotation matrix from openGL to DirectX ?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Pep
  • 13
  • 1
  • 5

1 Answers1

2

Regarding the handedness of your underlying coordinate system and a given rotation transformation, the positive rotation in a right-handed coordinate system is determined by the right-hand rule and vice versa. So, if you have two coordinate systems with a different handedness by flipping the sign in front of the rotation angle you have adjusted the rotation matrix. You have ported your rotation matrix :)

Mandark
  • 798
  • 1
  • 12
  • 33
  • Thank you for your reply. Actually, you're right. I just found a really understandable article which sums up a method to do it, it saved me a lot of time [Transformation matrices between OpenGL and Direct3D](http://cv4mar.blogspot.fr/2009/03/transformation-matrices-between-opengl.html) – Pep Mar 19 '13 at 16:50
  • You're welcome. Just a reminder as I see you are a new user, you should mark this question as being answered by clicking the green arrow underneath the up/down vote button. – Mandark Mar 20 '13 at 08:16