Sign in to follow this  

translation does not work..

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

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