Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirectXMath: XMMatrixPerspectiveFovLH AspectHByW? #25

Closed
nlguillemot opened this issue Apr 5, 2016 · 4 comments
Closed

DirectXMath: XMMatrixPerspectiveFovLH AspectHByW? #25

nlguillemot opened this issue Apr 5, 2016 · 4 comments

Comments

@nlguillemot
Copy link

There's no github for DirectXMath, so I guess this is the next best thing.

I think the AspectHByW parameter of XMMatrixPerspectiveFovLH should be AspectWByH.

If you look at the math to compute m[0][0] and m[1][1] inside XMMatrixPerspectiveFovLH, you'll see that it's identical to the math used in gluPerspective. However, gluPerspective's aspect parameter is width/height.

How could gluPerspective and XMMatrixPerspectiveFovLH use the same math, but have a different meaning? Futhermore, the results in my app look wrong when I pass height/width, but look correct when I pass width/height.

@walbourn
Copy link
Member

walbourn commented Apr 5, 2016

The first thing to say is that gluPerspective should be compared with XMMatrixPerspectiveFovRH, not LH because all OpenGL math is generally column-major, right-handed.

You are correct that the aspectRatio should be W / H as documented on MSDN. The name AspectHByW is confusing so it should probably just be changed to AspectRatio

@walbourn
Copy link
Member

walbourn commented Apr 5, 2016

Note that I've been considering a DirectXMath GitHub for some time. I'll see if I can make that happen this year...

@walbourn
Copy link
Member

There is now a DirectXMath GitHub. I've created this issue there.

@nlguillemot
Copy link
Author

Nice! Well done on making it happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants