Jump to content
  • Advertisement

Archived

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

johnnyBravo

ID3DXLine how to draw 3d Line?

This topic is 5192 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 using ID3DXLine how would i draw a 3d line? that is using draw transform, HRESULT DrawTransform( CONST D3DXVECTOR3* pVertexList, DWORD dwVertexListCount, CONST D3DXMATRIX* pTransform, D3DCOLOR Color ); ive used the normal 2d draw line but i cant seem to work the 3d one(drawTransform) Like i get a line from the middle of the screen going to the top right, thats all. Anyone know how to use this?

Share this post


Link to post
Share on other sites
Advertisement
Never used d3dxline before, but I see that it has a parameter for a transformation matrix. Why don''t you pass a combined matrix of rotation and translation to it?

D3DXMatrixRotationY (&matRot, 45.0f * ToRadian);
D3DXMatrixTranslation (&matPos, 5,5,5);

matWorld = matRot * matPos; <-- notice the operand order.

DrawTransform (blah blah, blah, &matWorld, color);

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi
I tried to use ID3DXLine and I only got garbage... I used DirectX 9.0 SDK, so I don''t if .a or whatever version appeared later has fixed it.
So basically it sucks. To draw 3D lines you have LINE_LIST or LINE_STRIP primitives. Just fill vertex buffer with line''s points and draw it with DrawPrimitive or DrawPrimitiveUP (this is what I use, to see my QuadTree boxes)

Hope it helps

Share this post


Link to post
Share on other sites
ID3DXLine is for 2D only last I checked. Its only there so you can draw openGL style lines (variable borders, anti aliased, etc...)

-Eric

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!