[SlimDX] Draw dotted line

Started by
4 comments, last by russell1983 14 years ago
I want to draw dotted line using SlimDX. How to do it? Are there some examples?
Advertisement
The only way i know of is to draw line lists using the standard Draw*Primitive() calls. You'd have to work your the spacing yourself ofcourse.
There are plenty of papers floating around the internet on rendering thick lines (look for things like 'contour edges,' 'silhouette edge rendering,' 'thick,' 'textured' or 'stroked' line rendering, et cetera). You can then implement one of the algorithms described therein -- the textured line implementations will likely give you the easiest means of creating a dot or stipple pattern in the line.
You should also be able to set a texture (and shader if you need it) on a standard line primitive, which will get you a dashed effect with an appropriate texture and UV coordinates. You'll probably want to wrap a texture along the length of the line, and set the UVs based on the line length so the dashes don't scale with line length.
Also if you're using D3D9, there's the Line interface that takes a stipple pattern.
Thanks for answers. I use D3D9 and I want to use class SlimDX.Direct3D9.Line. When I use MDX to draw dotted line I use following pattern - 0x88888888. This pattern
is uint type. But member Pattern(class Line) is int type. When I cast 0x88888888 to int type it does not draw dotten line. How can I solve this problem?

This topic is closed to new replies.

Advertisement