Jump to content
  • Advertisement

Archived

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

johnnyBravo

So D3DPT_LINELIST and draw command works like this?

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

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
Advertisement
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
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

  • 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!