Archived

This topic is now archived and is closed to further replies.

TomCorbett

Left handed vs right handed

Recommended Posts

Hi Im converting an engine from GL to D3D and im having an issue with the coordinate system. What exactly should I be doing to convert my geometry and transformations from OpenGL, which i believe is right handed, to D3D which is left handed. thanks any help is greatly appreciated.... -Tom

Share this post


Link to post
Share on other sites
DirectX has functions to operate with both
right handed and left handed.
eg:

D3DXMatrixLookAtRH() //Right handed
D3DXMatrixLookAtLH() //Left handed

Kamikaze

Share this post


Link to post
Share on other sites
From the DX SDK docs:

quote:

Microsoft® Direct3D® uses a left-handed coordinate system. If you are porting an application that is based on a right-handed coordinate system, you must make two changes to the data passed to Direct3D.

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.
To obtain what amounts to a right-handed world, use the D3DXMatrixPerspectiveRH and D3DXMatrixOrthoRH functions to define the projection transform. However, be careful to use the corresponding D3DXMatrixLookAtRH function, reverse the backface-culling order, and lay out the cube maps accordingly.


Share this post


Link to post
Share on other sites