Jump to content
  • Advertisement
Sign in to follow this  
_Flecko

Line primitve thickness

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

When I'm drawing instances of Line with the Sprite class, I can set their thickness. Is there any way to do the same thing with line lists drawn with Device.DrawPrimitives()?

Share this post


Link to post
Share on other sites
Advertisement
do you mean ID3DXLine?
Seems useless to me when using 3D points with ID3DXLine::DrawTransform() method.
I opened a thread asking for help but noone knew the answer to it. I mean, it works fine as long as the vertex points you pass lay within the clipping volume, otherwise strange behaviours happen.
Anyone solved this?

Share this post


Link to post
Share on other sites
Sorry to bump this, been a while since I checked it.

The problem with Line is that you have to draw them one at a time, and I need to draw a lot of them (it's a one-shot deal, a map preview rendered to texture once). The draw call, of course, has massive overhead, so it makes my relatively fast computer choppy and would probably cause an older one to pause for a second.

Share this post


Link to post
Share on other sites
Quote:
Original post by _Flecko
Sorry to bump this, been a while since I checked it.

The problem with Line is that you have to draw them one at a time, and I need to draw a lot of them (it's a one-shot deal, a map preview rendered to texture once). The draw call, of course, has massive overhead, so it makes my relatively fast computer choppy and would probably cause an older one to pause for a second.


One at a time? No no, you can pass a whole line list to the call. Hundreds can be drawn fairly fast. Look at the docs again. (I assume you're using a fairly recent DirectX?)

Share this post


Link to post
Share on other sites
As far as I can tell, it can only be used to draw line strips, not lists. The structure I'm trying to draw isn't a strip - there is a set of nodes and a set of edges connecting them. If I recall correctly, finding euler circuits is an intractable problem, which means that finding lists in the graph is not computationally worthwhile. Only methods that will let me draw line lists instead of strips are feasible.

Share this post


Link to post
Share on other sites
Make your lines very thin quads and render using indexed triangle list (6 indices, 4 vertices per line). That should work reliably and be fast, right? Batch 'em all together, it makes no difference if they are connected...

Share this post


Link to post
Share on other sites
You can draw lists in the Line interface by the sequence:

Line.Begin()
Line.Draw()
Line.Draw()
...
Line.End()

Most of the state setup will be done in Begin(), and I believe the rendering is done in End(). IIRC, the Draw() calls are pretty lightweight.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!