Jump to content
  • Advertisement
Sign in to follow this  
Twidizle

translation does not work..

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

Hey,

I'm trying to translate a simple triangle using the d3dx methods. The scaling and rotation seem to work but for some crazy reason the translate doesn't. here is basically what I am doing:

// create a rotation matrix
D3DXMatrixRotationY(&matRotate, D3DXToRadian(180.0f));

// create a translation matrix
D3DXMatrixTranslation(&matTrans, 10.0f, 2.0f, 0.0f);

// create a view matrix
D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3(1.5f, 0.5f, 1.5f), // the camera position
&D3DXVECTOR3(0.0f, 0.0f, 0.0f), // the look-at position
&D3DXVECTOR3(0.0f, 1.0f, 0.0f)); // the up direction

// create a projection matrix
D3DXMatrixPerspectiveFovLH(&matProjection,
(FLOAT)D3DXToRadian(45), // field of view
(FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT, // aspect ratio
1.0f, // near view-plane
100.0f); // far view-plane

// create the final transform
matFinal = matRotate *matTrans* matView * matProjection;

devcon->UpdateSubresource(pCBuffer, 0, 0, &matFinal, 0, 0);

Edit: Nevermind I got it to work... I was going out of bounds when translating it.

Share this post


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