Jump to content
  • Advertisement

Archived

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

mdias

How to draw a line in D3D ???

This topic is 5681 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, I want to draw a line, just like as in the "mview.exe" program from the DX8 SDK, it shows the normals of the mesh with lines, how can I draw these kind of lines ??? (not wireframe) Kamikaze

Share this post


Link to post
Share on other sites
Advertisement
Well, an easy way might be to take the vertex point as the first point of the line, then add the normal vector to the vertex location as the second point. Since the normal should be no longer than 1, you will end up with a line that is 1 unit long extending from the vertex in the direction of the normal. Make sense?

Always remember, you''''re unique. Just like everyone else.

Share this post


Link to post
Share on other sites
I think he wants to know how to draw the line, not how to get the coords for the line

You will have to change the primitive type of your rendering call (the first parameter), normally you would use something like D3DPT_TRIANGLESTRIP or D3DPT_TRIANGLELIST, but for lines you have to use D3DPT_LINELIST or D3DPT_LINESTRIP

Share this post


Link to post
Share on other sites
So, I''ll have to create a vertex buffer with 2 vertices...
Sounds great

Thanks to everyone that posted

Share this post


Link to post
Share on other sites
By the way,can anyone tell me how to change the color of the
printed line, like yellow, or red, or something ??

Any help would be appreciated

Kamikaze

Share this post


Link to post
Share on other sites
ya that''s easy just add D3DCOLOR diffuse; to your FVF then when you stuff in the vertex data include D3DCOLOR_RGBA(red, green, blue, alpha) after the rest of the data. and unless i forgot a step that is it.

The only thing that defines man from animal is our knowledge of computer programming.

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!