Sign in to follow this  
Black Knight

OGL to D3D Conversion

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this