How to reset the identity matrix?

Started by
1 comment, last by jollyjeffers 18 years ago
Ok I am rendering a texture quad and would like to render it at a different place and would like to come back to 0,0,0 and do something else. I have a OpenGL background, but not sure what DX has thats like Push/Pop matrices. I would call LoadIdentity() once and use the push/pop to move around and place objects... Thanks
Advertisement
D3D as standard doesn't have matrix stacks. D3DX exposes them as an interface (ID3DXMatrixStack), however.

To set the identity matrix, you just call:
D3DXMATRIX mat;
D3DXMatrixIdentity(&mat);
pDevice->SetTransform(D3DTS_WORLD, &mat);
Everything from now on will be rendered using an identity matrix.
Just to add what Steve said... The software design/architectural concepts behind OpenGL's matrices are different to Direct3D's. The end result is pretty much the same (once you've compensated for LH/RH) but the code is fairly different.

The biggest problem I had when I tried OpenGL was getting my head around how to use it's matrix system.

Might be a good idea to try and get used to the "D3D Way" rather than program D3D like you're programming OpenGL.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement