Jump to content
  • Advertisement
Sign in to follow this  
ynkm169

How to draw perspective correct ID3DXLine using DrawTransform?

This topic is 3971 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 am wondering what transformation is needed to draw perspective correct lines? I had non-perspective-correct version working but when I say this: HR(mLine->DrawTransform(pVertexList, 5, &mViewMatrix, D3DCOLOR_XRGB(255, 0, 0))); //does not work instead of this: HR(mLine->Draw(pVertexList, 5, D3DCOLOR_XRGB(255, 0, 0)));//works I see nothing displayed on screen. Here is my view matrix. I am wondering if I should use some other matrix. D3DXMATRIX mViewMatrix; D3DXVECTOR3 pos(0.0f, 0.0f, -1000.0f); D3DXVECTOR3 up(0.0f, 1.0f, 0.0f); D3DXVECTOR3 target(0.0f, 0.0f, 0.0f); D3DXMatrixLookAtLH(&mViewMatrix, &pos, &target, &up); HR(gd3dDevice->SetTransform(D3DTS_VIEW, &mViewMatrix)); I also tried to use my projection matrix. This time I see my lines but they are several times bigger than expected. D3DXMATRIX P; RECT R; GetClientRect(mhMainWnd, &R); float width = (float)R.right; float height = (float)R.bottom; D3DXMatrixPerspectiveFovLH(&mProjectionMatrix, D3DX_PI*0.25f, width/height, 1.0f, 5000.0f); HR(gd3dDevice->SetTransform(D3DTS_PROJECTION, &mProjectionMatrix)); Thanks! [Edited by - ynkm169 on November 4, 2007 9:33:29 AM]

Share this post


Link to post
Share on other sites
Advertisement
I think you need to send in the combination of both the view and projection matrices. It looks like you tried one, then the other. All you should have to do is multiply them together and pass it into the function.

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!