Jump to content
  • Advertisement
Sign in to follow this  
tscott1213

OpenGL Matrix Concatenation in GL vs D3D

This topic is 5034 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 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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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

So your answer is 'PVW'...

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!