Friday, June 28, 2002, 11:34:54 AM, you wrote:
So avoid glLine calls, and instead generate long thin
rectangles and texture them with a line texture.
I don’t see much benefit in putting multiple line textures into a
single rectangular texture. It’s not like you’d save any significant
amount of space.
DO> Nah - I just figured indexing width -> texcoords is about as
DO> complicated as width -> texture name, so why waste space?
DO> Besides, if you want to handle very fat lines, you’ll need rather
DO> large textures for the wider lines - and you’ll need many of them,
DO> as you can’t stretch them too much without blurring the edges.
DO> That said, it’s probably a good idea to split very fat lines along
DO> their length and implement the “width scaling” in some other way.
DO> BTW, any great ideas about how to do nice, antialiased “end caps”?
If you’re looking to join the lines with a pointed end cap, I don’t
see a way other than to do the math for where the intersection points
lie and to construct the appropriate triangles.
If you’re going to join with a rounded end cap, you MAY be able to get
away with drawing a circle (or solid arc) of appropriate size, as long
as everything you’re drawing is solid color with no alpha (you can
probably do some edge AA). Otherwise, you’ve got to do the math. Hence
my comments about having a lot of work to do.
You can use OpenGL’s 1D or 2D texturing and simply set the texture to
repeat for the length of the line.
DO> Yeah, but you can’t adjust the line width that way. If you want
DO> antialiased lines (without FSAA, of course), you need a texture
DO> with an alpha channel so you can have a “border” of transparent
DO> pixels within the rendered polygons. (The texture filtering +
DO> alpha will take care of the AA.)
I’m not sure we’re talking about the same thing. The idea is to stripe
the texture ACROSS the line, not along it.
Example:
Suppose you’re drawing a wide line. Here’s the polygon:--------------------------------------------------
| |
| |
You can make a 1D texture that looks like this:
<****>
(the < and > indicate alpha of 50%, the * is alpha of 0%.)
Then you apply it to the line like this:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
This doesn’t give you antialiased ENDS on the line, but it handles the
width fine. But again, the end cap problem is a different problem.
DO> That might work, though. Not sure if one should really expect
DO> this to give the same result, but considering how most cards do
DO> texture filtering, it should work pretty well.
It does. We did it exactly this way in MindRover. Every line was a
thin quad textured across with a 1D texture that went from transparent
to solid to transparent. It worked great.
Kent
–
Kent Quirk, CTO, CogniToy
@Kent_Quirk
http://www.cognitoy.com