# OpenGL Matrix Concatenation in GL vs D3D

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

## Recommended Posts

I am getting a little thrown on Matrix concatenation in D3D (which uses row vectors) and OpenGL (which uses column vectors). Specifically, if we are creating the WorldViewProj matrix from the following matrices: W = world matrix V = view matrix P = proj matrix Should the order in D3D be WVP while in OpenGL it would be VPW? Thanks Todd

##### Share on other sites
In Direct3D W and V matrices are separate while in OpenGL W and V matrices are one, the modelview matrix. And what do you mean by order?

##### Share on other sites
I have wonered about this for awhile. At the moment my, possibly wrong, conclussion is that the order is still the same.

Actually thinking bout it I think OpenGL has the order in reverse. So to create the modelview matrix you have to do view then model as you suggested in your post where as with DirectX it is model then view.

Chris, another confused person.

##### Share on other sites
Khaosifix,

What I mean by order is that if I have a World Matrix (W) for a model, a View Matrix (V) maybe in a camera class, and a Projection Matrix (P).

Because D3D uses row vectors, we would create a single concatenated matrix for rendering by multiplying W*V*P. However, because OpenGL uses column vectors, I believe that this same concatenated matrix would need to be created by multiplying P*V*W.

That is what I am trying to verify/refute.

Thanks for the help.
Todd

##### Share on other sites
If you transpose matrices you have to invert the order of the multiplications...

[DX(1)] T1 = W1 x V1 x P1
[GL(2)] T2 = P2 x M2 (T1 = T2transposed)

If you want to separate world and view then

T2 = P2 x M2 = P2 x V2 x W2

Thanks.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 31
• 9
• 16
• 22