Sign in to follow this  

Should I still set my world matrix, even if i'm not using it?

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

Hi, I was wondering if I should bother setting my world matrix, even though I'm not actually using it to move any of my 3d objects. eg D3DXMATRIXA16 matWorld; D3DXMatrixTranslation(&matWorld, 0.0f, 0.0f, 0.0f); d3dDevice->SetTransform(D3DTS_WORLD, &matWorld); Thanks

Share this post


Link to post
Share on other sites
If you've already set it once, and it's not changed from the last frame then there's no reason to set it. The default world matrix is the identity matrix, so if you need something else, you'll need to set it at least once.
Also, you're better using D3DXMatrixIdentity(), since that's what it's for.

Share this post


Link to post
Share on other sites
I meant can I just not even setting it once, to not even call it at all, could that cause any problems?

... I didnt know about the identity matrix, i'll be having quick look at that now.

Share this post


Link to post
Share on other sites
According to the docs, the default transform matrices are all the identity matrix. The identity matrix is exactly the same as a translation of 0 (what you had). So not setting the world matrix means you'll just have the identity matrix, which means no translation.

So, there's no problem with leaving the line of code out (which is what circlesoft said).

Share this post


Link to post
Share on other sites

This topic is 4667 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this