Jump to content
  • Advertisement


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


Y Axis in orthogonal projection

This topic is 5935 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

I have a primarly 2-D project that I am upgrading to use DirectX8. Per many suggestions here I am using textured quads and an orthogonal projection to achieve my goal. I have found that by default (0,0) is in the lower left corner of the screen rather than the upper left. This makes perfect sense since that is how cartesian coordinates work, but I have soooo much code using the traditional GDI-style coordinates. Is there any command that will change DX''s coordinate system? I have looked at left-handed vs. right-handed, but this only seems to change the Z axis. Thanks, LEJ

Share this post

Link to post
Share on other sites
Just change your projection matrix so that it:

1) negates Y so that for say 0 to 480 (bottom to top) you get 0 to -480

2) adds the height (e.g. 480) back onto Y so that your 0 to -480 ends up as 480 to 0 (i.e. upside down for 3D, but what you''re after for 2D)

How to do this depends on how your ortho projection matrix is set up, but you can try the following after you''ve made the projection matrix:

matrix._22 = -matrix._22; // negate Y
matrix._42 = matrix._42 + height; // add height

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
I feel really dumb now, but I just reversed the arguments in the D3DXMatrixOrthoLH call and it works like a champ. Amazing how much clearer things are after a few hours of sleep! Thanks for your reply.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!