🔒 Locked
D3DMATRIX?
Advertisement
Original Post
What are you trying to do? Are you trying to creat your own matrix that can be interchanged with D3DXMATRIX? Are you trying to build a certain type of matrix (E.g. rotational)? Are you trying to set up the transform state to view something?
Well I know on the Nehe tutorial it speaks of openGL using float array of 16 floats to create the matrix and I actually am just trying to render a simple model to the screen and to view but I am under the assumption that I need to use the matrix for putting each vertex on the screen and positioning their normals. Is this the case?
Azteroth
Azteroth
D3DX has a bunch of functions for setting up matrices for you, like D3DXMatrixRotationX, D3DXMatrixMultiply, D3DXMatrixTranslation, etc. I wouldn't work with the raw matrix data unless you absolutely have to.
I'd recommend reading up on some matrix maths before going any further. A matrix (in this context) is a way to transform a geometric point in some way (A normal is just a point with a distance from the origin of 1). A rotation matrix will rotate a point around another point (the origin), around an axis, a translation will move that point towards from or away from another point (the origin, again), a skew matrix will skew the points, and so on.
When you want to say, rotate and move a point, you multiply the matrices together. Matrix multiplication is not communicative; A * B is not the same as B * A. If C = A * B, then transforming a point by C has the same effect as transforming a point by A, then by B.
OpenGL matrices are the same as Direct3D matrices, except that OpenGL matrices are the transpose of D3D matrices I belive (I've never used OpenGL myself), meaning the order of the elements when you refer to them as a float array is different.
When you want to say, rotate and move a point, you multiply the matrices together. Matrix multiplication is not communicative; A * B is not the same as B * A. If C = A * B, then transforming a point by C has the same effect as transforming a point by A, then by B.
OpenGL matrices are the same as Direct3D matrices, except that OpenGL matrices are the transpose of D3D matrices I belive (I've never used OpenGL myself), meaning the order of the elements when you refer to them as a float array is different.
Quote:
Original post by Evil Steve
...
Matrix multiplication is not communicative; A * B is not the same as B * A. If C = A * B, then transforming a point by C has the same effect as transforming a point by A, then by B.
...
You probably meant to say "commutative".
You are right I do need to read up on this but the best way I have learned in this whole process is to learn by doing so I am going to look around to find some examples of model loaders in directx and looks around for the math and see how they work together. Thank you so much for your help.
Azteroth
Azteroth
Quote:
Original post by Azteroth
You are right I do need to read up on this but the best way I have learned in this whole process is to learn by doing so I am going to look around to find some examples of model loaders in directx and looks around for the math and see how they work together. Thank you so much for your help.
Azteroth
The problem with that is often you'll know how to use it, but not how it works.
I, too, suggest you do some reading on matrix maths, specifically as they apply to 3D graphics.
Quote:Oddly, I thought that was the word, but the link I got on Google to check said communicative [smile]
Original post by don Quote:
Original post by Evil Steve
...
Matrix multiplication is not communicative; A * B is not the same as B * A. If C = A * B, then transforming a point by C has the same effect as transforming a point by A, then by B.
...
You probably meant to say "commutative".
Understand that in the sense of linear algebra, a position is represented by a vector, a direction is also represented by a vector, and a transformation is represented by matrix. In order to apply the transformation to a point, you simply multiply the corresponding matrix and vector, to get a new vector, which represents the new, transformed point.
There's a lot to learn, but a good starting place would be the maths subsection section of GameDev's Articles. Start with vectors, then, when you're comfortable, move on to matrices. Don't worry about quaternions until you have the basics down.
Admiral
There's a lot to learn, but a good starting place would be the maths subsection section of GameDev's Articles. Start with vectors, then, when you're comfortable, move on to matrices. Don't worry about quaternions until you have the basics down.
Admiral
Thanks a lot for your guys help and to Sc4Freak I do understand what you are saying and in my post I did not mean to imply that I would "just" look at the examples in my learning process in getting to this point I have made sure that I do understand the underlying factors that make the stuff work. I actually was looking into the stuff when I decided to come back here and look now theres a link :).
Thank you for the link TheAdmiral.
Azteroth
Thank you for the link TheAdmiral.
Azteroth
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement