Problems using ID3DXLINE

Started by
2 comments, last by jollyjeffers 18 years, 5 months ago
Hey all, Im am currently having a lot of difficulty using ID3DX line to draw lines, one of my main problems is that im struggling to understand how it works and as such cant implement it correctly. I have a fully functioning particle system and am currently simulating rain by using the g_D3dDevice->DrawPrimitive( D3DPT_LINELIST, 0, count ); command. I am now trying to move over to ID3DXLINE as it provides support for wider lines, making my lines transparent and will basically look much better. What origenally confused me was that ID3DXLINE->DrawTransform() needs a transform matrix. Why is this? The coordinates that my lines use are already in the correct space as they are functioning correctly with the DrawPrimitive call, however if I use these same coordinates within the ID3DXLINE->DrawTransform() function with a identity matrix nothing is rendered. Could anyone please point me in the right direction for using ID3DXLINE correctly and on where I am going wrong? Thanks a lot for any help
Advertisement
A quick thought... ID3DXLine is for 2D lines - whereas a particle system is typically defined in 3D. If you pass it 3D coordinates then they're less likely to be valid for a 2D screenspace system thus giving you incorrect results.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

ID3DXLINE is for 2D lines? I wasn’t sure if that was the case, if so then yeah I definitely shouldn’t be using it.

Is there anyway to change the properties of lines being drawn via the DrawPrimitive function? As in changing the width of lines etc?

Thanks for the reply JollyJeffers, you always seam to help me out with my queries ;-)
Quote:Original post by hoogie
ID3DXLINE is for 2D lines? I wasn’t sure if that was the case, if so then yeah I definitely shouldn’t be using it.

To quote the official documentation:

Quote:ID3DXLine::Draw Method
Draws a line strip in screen space


Quote:Original post by hoogie
Is there anyway to change the properties of lines being drawn via the DrawPrimitive function? As in changing the width of lines etc?

No, not really. You have to write the code to change the thickness of the lines. Exactly how you do this very much depends on how much work you're willing to put into it and what sort of results you're after. For example, a very simple hack might be to transform the start/end of the line from world->screen space and then use ID3DXLine...

Quote:Original post by hoogie
Thanks for the reply JollyJeffers, you always seam to help me out with my queries ;-)

My pleasure! I actually live in these forums - I don't have a real house in the real world [smile]

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement