Archived

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

johnnyBravo

So D3DPT_LINELIST and draw command works like this?

Recommended Posts

johnnyBravo    100
im drawing lines with drawPrimitive, im just curious if this is the right way to do it, im pretty sure from testing, but not confident that its right. Ive put comments in for the questions
Vertex3a vertex[3];
vertex[0].position = D3DXVECTOR3(0,0,0);
vertex[0].normal  = D3DXVECTOR3(-1,-1,-1);
vertex[0].ctexture  = D3DXVECTOR2(0,0);

vertex[1].position = D3DXVECTOR3(10,0,0);
vertex[1].normal  = D3DXVECTOR3(-1,-1,-1);
vertex[1].ctexture  = D3DXVECTOR2(0,0);

vertex[2].position = D3DXVECTOR3(0,10,0);
vertex[2].normal  = D3DXVECTOR3(-1,-1,-1);
vertex[2].ctexture  = D3DXVECTOR2(0,0);

//draws line between line 0 and 1?

lp_Device->DrawPrimitive( D3DPT_LINELIST, 0, 1); 

//draws line between line 1 and 2?

lp_Device->DrawPrimitive( D3DPT_LINELIST,1, 2); 

//draws line between line 0,1 and 2?

lp_Device->DrawPrimitive( D3DPT_LINELIST, 0, 2); 

thanks,

Share this post


Link to post
Share on other sites
Fidelio66    164
With a linelist you would need to specify 4 points, a,b,b,c if you want to draw a line between a and b and b and c. If you specify 3 points you can do it, by using D3DPT_LINESTRIP which, if you specify points a,b,c,d,e,f would draw a-b, b-c, c-d, d-e, e-f. If you specified D3DPT_LINELIST it would draw a-b, c-d, e-f.

Share this post


Link to post
Share on other sites
DrunkenHyena    805
The second parameter to DrawPrimitive is the StartVertex, the third is the PrimitiveCount.

lp_Device->DrawPrimitive( D3DPT_LINELIST, 0, 1);
- Draw 1 line starting with vertex 0

lp_Device->DrawPrimitive( D3DPT_LINELIST,1, 2);
- Draw 2 lines starting at vertex 1 (which won''t work since there isn''t enough data in the VB)

lp_Device->DrawPrimitive( D3DPT_LINELIST, 0, 2);
- Draw 2 lines starting at vertex 0


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites