Converting from directx matrix to opengl matrix

I'm not entirely sure what the difference is i know they hold their translation vector in different spots but I don't know much more than that.

is this a question or an answer?  :expressionless:

The main difference is that DirectX uses the left-hand coordinate system and OpenGL uses the right-hand coordinate system.



Here’s a link explaining the this:

http://www.mindcontrol.org/~hplus/graphics/matrix-layout.html



Here’s another link to a discussion about converting between the two:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=235892&SiteID=1

question, sorry for my poor wording.



I read the Microsoft one but it seemed that they hadn't reached a conclusion.



from the second link it seems that transposing a DirectX matrix makes it into OpenGL matrix

is that right?

Short answer: Yes  :slight_smile:



Long answer: Matrices are really only an array of numbers, the only difference is the conceptual representation: Called row-major and column-major. In row-major, contiguous chunks of numbers are treated as rows (i.e. the first 4, then the next 4, etc.), whereas in column-major, they are considered columns.

coloum-major and row-major  is the only difference between a DirectX matrix and an OpenGL matrix?

Yes if you only care about conceptually applying a transformation matrix M to a vector x. Here:



DirectX: x' M'

OpenGL: M x



where x' is the row vector (transpose) corresponding to the column vector x, and M' is the transpose of M.



If you want to concatenate transformations, then DirectX is the transpose of the OpenGL, and multiplication is also flipped.