Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing thick lines



Hello,


I need to draw connected thick lines. At the moment, I draw polygons in line mode. It works, but I have some holes at the line joints. (I draw twice, a white one and a little thinner blue one)


I know it's normal for those hole to be here with my current method, now, I'm wondering what you'd suggest.

My first idea was to read the lines, compute the angle between each pair, and move the points to draw them a bit longer, depending of the angle.

I think it is hard to get right.


But before I do that, I wonder if any of you have a suggestion.

For a project that required nice lines, I drew each line segment separately as a quadrilateral. The quadrilateral was made as wide as the line thickness and extended in length by half the thickness at either end. Then in a shader, I compute the color as a function of distance to the line segment, i.e. distance to line unless the pixel is off the end of the line in which case it is distance to end point. This means  that the line segment becomes rounded at either end.

When several lines are drawn, the joints will be rounded and there are no gaps. You can very easily do antialiasing using this method.

Andreas





Best regards

--
kuon


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (Mac-opengl@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden

References: 
 >Drawing thick lines (From: "Nicolas Goy, Kuon" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.