cronodragon
05-11-2007, 04:13 PM
I found this information about how gluLookAt() makes the view transform matrix:
http://pyopengl.sourceforge.net/documentation/manual/gluLookAt.3G.xml
I was trying to replace D3DXMatrixLookAtLH() with a common function for both graphic subsystems (OpenGL and DirectX 9), but it seems DX doesn't work the same way. I thought I would just have to transpose matrices, but the difference is huge. These are the matrices I get:
ODS: -0.9999999 0 0 0
ODS: 0 0.7071066 -0.7071067 0
ODS: 0 -0.7071066 -0.7071067 0
ODS: 0.9999999 0 1.4142134 1
ODS:
ODS: -0.7071067 0 0 0.7071067
ODS: 0 0.4999999 -0.4999999 0
ODS: 0 -0.7071067 -0.7071067 0
ODS: 0 0 0 1
The first 4x4 matrix was made by D3DXMatrixLookAtLH(), and the second one is what I get with the matrix constructed as the document says. The main difference I see, is that D3DXMatrixLookAtLH uses the bottom row... that one is always (0, 0, 0, 1) with the method described. So how do they build their matrix? Looks odd :?
http://pyopengl.sourceforge.net/documentation/manual/gluLookAt.3G.xml
I was trying to replace D3DXMatrixLookAtLH() with a common function for both graphic subsystems (OpenGL and DirectX 9), but it seems DX doesn't work the same way. I thought I would just have to transpose matrices, but the difference is huge. These are the matrices I get:
ODS: -0.9999999 0 0 0
ODS: 0 0.7071066 -0.7071067 0
ODS: 0 -0.7071066 -0.7071067 0
ODS: 0.9999999 0 1.4142134 1
ODS:
ODS: -0.7071067 0 0 0.7071067
ODS: 0 0.4999999 -0.4999999 0
ODS: 0 -0.7071067 -0.7071067 0
ODS: 0 0 0 1
The first 4x4 matrix was made by D3DXMatrixLookAtLH(), and the second one is what I get with the matrix constructed as the document says. The main difference I see, is that D3DXMatrixLookAtLH uses the bottom row... that one is always (0, 0, 0, 1) with the method described. So how do they build their matrix? Looks odd :?