OGL to D3D Conversion
I was using OGL for a long time and I was using OGL all over the place in my project :|.
Now I'm adding D3D in to the soup too.So I created a base interface class etc.
What I want to know is OGL and D3D uses different coordinate systems.I don't exactly remember which one uses right handed or left handed but I know they are different :).
So I have a terrain extending on the x-z plane and rendered in OGL positive z points up.Now if I render this in D3D Z points up will that turn my terrain 90 degrees and make it vertical?Should make some transformation if Im rendering with D3D or should I modify the camera somehow.
Thanks for the replies.
The right and left handedness are mere conventions and depend on matrices. To say that one is different from the other is wrong. It is up to you to decide which one (handedness) you want to use. Direct3D offers APIs to create both types.
D3DXMatrixPerspectiveFovLH - Left handed.
D3DXMatrixPerspectiveFovRH - Right handed.
True, OpenGL doesn't offer an API for left-handed system out of the box, or rather GLU doesn't, but you can write your own function to create a left-handed matrix for OpenGL.
If you set left-handed matrices, you can make OpenGL behave exactly like Direct3D or vice-versa.
[Edited by - _neutrin0_ on July 7, 2007 9:09:45 AM]
D3DXMatrixPerspectiveFovLH - Left handed.
D3DXMatrixPerspectiveFovRH - Right handed.
True, OpenGL doesn't offer an API for left-handed system out of the box, or rather GLU doesn't, but you can write your own function to create a left-handed matrix for OpenGL.
If you set left-handed matrices, you can make OpenGL behave exactly like Direct3D or vice-versa.
[Edited by - _neutrin0_ on July 7, 2007 9:09:45 AM]
If I'm not mistaking OpenGL is right-handed and Direct3D is left-handed. In order to use Direct3D exactly like OpenGL, you can simply use right-handed projection and view matrices. Look into D3DXMatrix***RH for functions such as :
D3DXMatrixLookAtRH
D3DXMatrixOrthoOffCenterRH
D3DXMatrixOrthoRH
D3DXMatrixPerspectiveFovRH
D3DXMatrixPerspectiveOffCenterRH
D3DXMatrixPerspectiveRH
..which help building right-handed matrices.
D3DXMatrixLookAtRH
D3DXMatrixOrthoOffCenterRH
D3DXMatrixOrthoRH
D3DXMatrixPerspectiveFovRH
D3DXMatrixPerspectiveOffCenterRH
D3DXMatrixPerspectiveRH
..which help building right-handed matrices.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement