Jump to content
  • Advertisement

Archived

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

johan_swe

How to use D3DXLine

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

Advertisement
It doesn't work.

The code:

D3DXMATRIX matWorld;
D3DXMatrixIdentity(&matWorld);

D3DXVECTOR3 Lines[2] = { m_Start, m_End };

m_pD3DXLine->DrawTransform(Lines, 2, &matWorld, m_Color);

It seems to draw the line in screen space.

[edited by - johan_swe on November 12, 2003 1:19:44 PM]

Share this post


Link to post
Share on other sites
If you want perspective-correct lines, you have to pass your projection matrix, not an identity matrix. Query the device for the projection matrix and pass that to the function.

Share this post


Link to post
Share on other sites
Ït still doesn''t work...

D3DXMATRIX matProjection;

pDevice->GetTransform(D3DTS_PROJECTION, &matProjection);

D3DXVECTOR3 Lines[2] = { m_Start, m_End };

m_pD3DXLine->DrawTransform(Lines, 2, &matProjection, m_Color);

Share this post


Link to post
Share on other sites
Have you set up a projection matrix using a D3DXMatrixPerspective*() function followed by a SetTransform() call? If you haven''t set a projection matrix, then querying for one won''t do any good.

Share this post


Link to post
Share on other sites
When you enumerate devices you can check their caps.
Especially when you use the D3D Framework from the samples you will likely choose the pure device.

But you already said, you checked and it succeeds, so that isn''t your problem.

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.

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!