Comments on: Direct3D 10 to Direct3D 11: How to Transpose Your Matrices https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/ Graphics Cards and GPUs News, Graphics Programming, Home of FurMark Fri, 24 Nov 2017 13:01:33 +0000 hourly 1 https://wordpress.org/?v=6.7.1 By: Jeff Stryker https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-33001 Fri, 27 Sep 2013 15:54:38 +0000 http://www.geeks3d.com/?p=7186#comment-33001 It’s actually not a myth, and it’s nothing to do with left-handed or right-handed – DX9 can handle either handedness fine. And whether the internal storage is transposed is irrelevant. What matters is that when you take a 16-float chunk of data and send it as a D3DXMATRIX to DX9, and take the same chunk and send it to GL using glUniformMatrix4fv, or in a constant buffer, you have to transpose one of them in order to get the same result from a premultiply operation. As of DX11, you can use the SAME CODE to set up a constant buffer for GL or DX11, and send that buffer to the shader. Then a premultiply will work the same for either.

]]>
By: Grandmaster B https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-12848 Sat, 26 Jun 2010 15:36:41 +0000 http://www.geeks3d.com/?p=7186#comment-12848 Its a myth that OpenGL matrices are transposed in relation to Direct3D 10 and before. Both APIs had the same matrix storage order they just used a different math convention in their documentation – therefore the myth.

You can easily check that by using glRotate and glTranslate. There was (or is?) also an official statement on opengl.org.

The one thing that is different is the corrdinate system, while Direct3D uses a left-handed coordinate system, OpenGL uses a right-handed coordinate system, this needs a matrix conversion of the view matrix – for example.

]]>
By: hint https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-12839 Fri, 25 Jun 2010 08:03:04 +0000 http://www.geeks3d.com/?p=7186#comment-12839 No need to transpose your matrices before uploading them to the GPU. You can simply use the row_major keyword in your HLSL code.

]]>
By: DrBalthar https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-12823 Wed, 23 Jun 2010 13:01:15 +0000 http://www.geeks3d.com/?p=7186#comment-12823 You are aware that there is setMatrixTranspose in D3D Effect?

And you are also aware that D3DXMATH is replaced with XNAMath?

]]>
By: Mars_999 https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-12820 Tue, 22 Jun 2010 19:41:13 +0000 http://www.geeks3d.com/?p=7186#comment-12820 Ha, maybe DX11 should be a wrapper around OpenGL! 🙂

]]>
By: somari https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-12819 Tue, 22 Jun 2010 15:50:18 +0000 http://www.geeks3d.com/?p=7186#comment-12819 Wait, wait.
In GLSL, there’s this:

mat4 m1;
mat4 m2; // = transposed m1
vec4 v;

m1*v == v*m2;

]]>
By: Lokavidu https://www.geeks3d.com/20100622/programming-tips-direct3d-10-to-direct3d-11-transpose-your-matrices/#comment-12816 Tue, 22 Jun 2010 15:14:39 +0000 http://www.geeks3d.com/?p=7186#comment-12816 nice tip, thx 🙂

]]>