Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Dwarf with Axe

Some beginner questions

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

Thanks for your help in advance. I just started working with DX8 graphics about three days ago. I''ve dived into it pretty fast, and so far everything is all right - I''m at a good pace - save for a few questions. I''m proficient with OpenGL, and I''m not sure if the matrices operate the same way. If I wanted to draw two different things that each have their own, say, rotation and position, would I do something like this:

D3DXMATRIX rotMat; //rotation matrix

D3DXMATRIX trnMat; //translation matrix

D3DXMATRIX endMat; //final matrix

D3DXMatrixTranslation(&trnMat, var_x, var_y, var_z);
D3DXMatrixRotationZ(&rotMat, var_rot);
D3DXMatrixMultiply(&endMat, &rotMat, &trnMat);

g_pd3dDevice->SetTransform(D3DTS_WORLD, &endMat);

//Then draw the thing that uses the var_x, var_y,

//var_z, and var_rot

//Question 3: Should I D3DXMatrixIdentity right here to all

//the matrices?

D3DXMatrixTranslation(&trnMat, var2_x, var2_y, var2_z);
D3DXMatrixRotationZ(&rotMat, var2_rot);
D3DXMatrixMultiply(&endMat, &rotMat, &trnMat);

g_pd3dDevice->SetTransform(D3DTS_WORLD, &endMat);

//now draw the stuff that uses the var2 variables

I''m used to encapsulating matrix calls, like glTranslatef() and glRotatef(), inside the pushing and popping matrix calls in OpenGL''s matrix stack. If this is all a bunch of n00b jibberish, could you tell me a better way to go about doing this? Thanks. ~ Jesse

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!