Jump to content
  • Advertisement
Sign in to follow this  
Nauraushaun

How are X and Y defined in DirectX?

This topic is 2559 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there,
This is a bit of a beginner question, but it's so DirectX oriented that I decided to take it here.
I've spent some time making a game in DirectX. At the beginning I realized that DirectX or Direct3D or whichever by default has -X as right, and X as left. So, if you put a sprite at (5, 6), it ends up 5 spaces to the left, 6 spaces up. Why is this? Graphs aren't like this, why is DirectX? I actually tinkered so that my objects would respond the opposite, with +X being to the right of screen, but this is almost definitely a poor method of solving the problem.
Thanks for your help.

Share this post


Link to post
Share on other sites
Advertisement
X and Y aren't strictly defined in any particular way, and you can have them work any way you wish. It all depends on the projection matrix you set up, and that can use either left-handed coords (using the D3DX -LH functions, for example), right handed coords (-RH functions), or be any custom matrix you wish. The only exception to this is if you supply pretransformed coords (equivalent to D3DFVF_XYZRHW in the old fixed pipeline), in which case top-left is 0,0 and positions increase as you move towards bottom-right.

Share this post


Link to post
Share on other sites
mhagain is right.

But what makes me wonder is how did you come to the assumption that in Direct3D by default the +X goes left?
If we were to discuss the "default" axes orientation, then it would rather be +X pointing right, +Y up and +Z into the screen (or from the screen with RH), because this orientation is suggested also by the transformed vertices (view space, screen space etc). And last but not least, this: http://msdn.microsoft.com/en-us/library/bb204853%28v=vs.85%29.aspx

To sum it up: it all depends on you (on your definition of the view and proj matrices), as mhagain said.
But the somehow "default" orientation is +X right and -X left, not as you said.

Share this post


Link to post
Share on other sites
I've been using LH functions, evidently. I don't think I know enough about it to risk a change, this late in the project.
Thanks for the pointers guys. I didn't even know what to search for originally.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!