Jump to content
  • Advertisement
Sign in to follow this  
stakon

[DirectX9 C++] - Lines in 3D stored in a mesh

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

Good day, I need to create some 3d lines in my scene and tried a few things out. If it is possible i would like to store each of those lines in a mesh. 1st try: Method - Draw a ID3DXLine and transform it by the view and projection matrices so it becomes 3d-like. Result - FAIL. Reason - When moving camera around, line seems to change direction... 2nd try: Method - Create a D3DXCreateCylinder()/Box with a thickness of 0.1f. Result - FAIL. Reason - This actually worked but if the camera moves away, the "line" appears dotted and some melds in the background.If not for this problem, it would be a perfect solution because it actually creates a mesh. 3rd try: Method - Fill a vertex and an index buffer with the line info and DrawIndexedPrimitive(). Result - 50% achieved. Reason - Ok. As expected this basic solution always works, but i there is no mesh created. I have read that in D3D10 there is a way to set the topology to D3D10_PRIMITIVE_TOPOLOGY_LINELIST, so when a mesh is created it draws lines instead of triangles. It would be great if there was something similar in D3D9... Any suggestions on the matter? A better approach than the methods above?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by superpig
Look into D3DPRIMITIVETYPE::D3DPT_LINESTRIP or D3DPRIMITIVETYPE::D3DPT_LINELIST.

But he wants to make a mesh from the lines, can you set a mesh to be rendered like LINESTRIP or LINELIST?

stakon - Why actually do you want (need?) it to be a mesh?

Share this post


Link to post
Share on other sites
The real reason i want my lines to be stored in meshes, is code uniformity.
This means that all 3D objects created so far are stored in meshes and it would be good to preserve this. This way the functions that are handling mesh objects can stay unchanged.

Of course if there is no way around this, i guess i'll go for the DrawIndexedPrimitive() method and recreate those functions mentioned above.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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