# OpenGL Modelview matrix

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

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
OpenGL modelview matrix should be the DX transposed...

##### Share on other sites
Quote:
 Original post by blizzard999OpenGL 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).

##### Share on other sites
Quote:
 Original post by MikeMJHI 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.

##### Share on other sites
Quote:
Original post by MikeMJH
Quote:
 Original post by blizzard999OpenGL 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.

##### Share on other sites
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

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634088
• Total Posts
3015453
×