Advertisement Jump to content
Sign in to follow this  
TimChan

matrix in opengl and dx

This topic is 4930 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 want to ask that what is the deference of matrix operation between opengl and directx. I know one difference is that the translation vector in opengl is the last column of a matrix 4x4 but one in directx is the last row of a matrix 4x4. Is that because of the different handedness of their coordinate systems? Another question is that how to convert a opengl matrix to directx matrix and vice versa? Is just making that matrix to be transposed? EDIT: hey, why did MS make such a difference!??

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by TimChan
I want to ask that what is the deference of matrix operation between opengl and directx. I know one difference is that the translation vector in opengl is the last column of a matrix 4x4 but one in directx is the last row of a matrix 4x4.

Is that because of the different handedness of their coordinate systems?


No, I'm pretty sure the handedness has nothing to do with whether the matrices are row or column major.

I'd answer the rest of your question, but I can't remember if the difference between OpenGL and DirectX matrices exists only in memory, or if it's purely a notational convention.

Share this post


Link to post
Share on other sites
Thanks for replies.

So can I get a directx matrix by making the opengl matrix be transposed or vice versa?

Share this post


Link to post
Share on other sites
Quote:
So can I get a directx matrix by making the opengl matrix be transposed or vice versa?
I can't be sure about the following because I don't use DirectX. But here's what I've gathered from reading about it...

Mathematically, a DirectX matrix and an OpenGL matrix are transposes of each other. However, because the storage conventions are also transposes of each other, the matrices are actually laid out in memory the same way.

I think the vector-matrix multiplication code for DirectX and OpenGL would be the same. However, matrix-matrix mult code will be different.

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.

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!