Matrix Concatenation in GL vs D3D

Started by
4 comments, last by tscott1213 19 years, 3 months ago
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
Advertisement
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?
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
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.
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
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

So your answer is 'PVW'...
Thanks.

This topic is closed to new replies.

Advertisement