# matrix in opengl and dx

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

## 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 on other sites
Quote:
 Original post by TimChanI 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 on other sites
They were talking about it earlier:
http://www.gamedev.net/community/forums/topic.asp?topic_id=333243

##### 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 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.

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 12
• 14
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633346
• Total Posts
3011447
• ### Who's Online (See full list)

There are no registered users currently online

×