PDA

View Full Version : Rendering Arcs and stipple patterns.



NTBone
04-26-2004, 04:41 AM
I am attempting to render an arc using a stipple pattern to render a dashed arc. The problem I am facing is that when the line segments are very small and a stipple pattern is used the arc seems to vanish (especially when zooming out). Does anyone have any ideas on how i could render an arc with a stipple pattern?

dorbie
04-26-2004, 05:03 AM
Try using a 1D texture and texture coordinates along the length of the line. With linear texture filtering you should be able to get much better control over the quality and frequency of the dashed line but you need to calculate the appropriate texture coordinates while doing so.

Relic
04-26-2004, 08:09 AM
Use a line strip! Independent lines reset the stipple pattern for each line, line strips continue the pattern in the sub-segments
This will work down to a specific length, but if the number of pixels drawn is less than the first zero bits in the pattern, you won't get anything. Either change your stipple patterns so that they always start with filled bits or change the pattern to a finer one if you have zoomed out over a threshold.
You can also vary the pattern with the repeat count. Use a dotted pattern like 0x5555 and make it dashes by adjusting the repeat, big when zoomed in, small when zoomed out. Gets some ugly popping effects, but better than nothing.

NTBone
04-26-2004, 09:15 AM
Thanks. The line strip thing worked. It turns out that I have 2 cases. When I draw an arrow in middle of arc i used lines, not line strips (easier to code). I will change it to line strips and it seems to work just fine.