Modelview matrix

Started by
14 comments, last by blizzard999 19 years, 3 months ago
Hi, I am implementing something in directx while using a openGL program as a reference and I came across a modelview matrix. I was just making sure this is the same as the view matrix in directx. The camera transformation matrix. Thanks, Chase
Advertisement
With respect to DX i think the direct equivalent would be a 'view * world' matrix. I'm not too familiar with DX (worked with 7, 8 and very limited in 9) so someone correct me if i'm wrong.
OpenGL modelview matrix should be the DX transposed...
Quote:Original post by blizzard999
OpenGL modelview matrix should be the DX transposed...


I don't think so. DirectX maintains a different concept than OpenGL--it has seperate World and View matrices, whereas OpenGL has a combined ModelView matrix. In this respect nts is correct.

It is true, however, that DirectX matrices' are column major (where OpenGL's are row-major by default).
Quote:Original post by MikeMJH
I don't think so. DirectX maintains a different concept than OpenGL--it has seperate World and View matrices, whereas OpenGL has a combined ModelView matrix. In this respect nts is correct.


You are right but...world and view matrices are not different concepts!

Nts is right too

[GL modelview] = transposed([DX view] * [DX world])

Load the same matrix and you get the same results.
Quote:Original post by MikeMJH
Quote:Original post by blizzard999
OpenGL modelview matrix should be the DX transposed...


I don't think so. DirectX maintains a different concept than OpenGL--it has seperate World and View matrices, whereas OpenGL has a combined ModelView matrix. In this respect nts is correct.

It is true, however, that DirectX matrices' are column major (where OpenGL's are row-major by default).


Um matrices in Direct3D are row-major while matrices in OpenGL are column-major.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
translation matrix

DX1 0 0 x   0 1 0 y   0 0 1 z   0 0 0 1GL1 0 0 0   0 1 0 0   0 0 1 0   x y z 1
From here:

Quote:9.005 Are OpenGL matrices column-major or row-major?

For programming purposes, OpenGL matrices are 16-value arrays with base vectors laid out contiguously in memory. The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix.

Column-major versus row-major is purely a notational convention. Note that post-multiplying with column-major matrices produces the same result as pre-multiplying with row-major matrices. The OpenGL Specification and the OpenGL Reference Manual both use column-major notation. You can use any notation, as long as it's clearly stated.

Sadly, the use of column-major format in the spec and blue book has resulted in endless confusion in the OpenGL programming community. Column-major notation suggests that matrices are not laid out in memory as a programmer would expect.
- k2"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {[email=kkaitan at gmail dot com]e-mail me[/email]} | {excellent webhosting}
No sir thats not right. According to a very reliable source[MSDN] the translation matrix in OpenGL goes more like this :

| 1 0 0 x || 0 1 0 y || 0 0 1 z || 0 0 0 1 |


For Direct3D you'd have to transpose the above matrix into row-major.
---http://www.michaelbolton.comI constantly dream about Michael Bolton.
Instead of rating me down why don't you google it for yourself? Or visit MSDN.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_9a05.asp
---http://www.michaelbolton.comI constantly dream about Michael Bolton.

This topic is closed to new replies.

Advertisement