Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

OpenGL How to reset the identity matrix?

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

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

Share this post


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

Share this post


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

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!