Jump to content
  • Advertisement
Sign in to follow this  
beavis6325

OpenGL Modelview matrix

This topic is 5065 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

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


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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


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


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

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!