Dashed thic lines

Hello!

I’ve benn googling for months but I finally surrender.
Maybe someone here can help me.
I’m writing a GIS (Geographic Information System). Therefore, I have to render complicated maps.

One of the main challenges consists in drawing thick dashed lines (roads, e.g).
Imagine a highway which is being constructed. It depends on the country, company, etc, but very often it’s drawn as a discontinuous (dashed) thick line (yellow with red borders).

Ok.

Drawing a thick line is relatively easy using triangle strips.
Applying red/yellow/red color to borders is also easy: you can draw the line twice, or you can use one-dimensional textures.

But I can’t figure out how can I achieve the discontinuity. If I use a bi-dimensional texture (half of it with alpha zero) then the problem is assigning texture coordinates. And that’s a huge problem.

Ah! I cannot use shaders (I don’t even know what a shader is :wink:

Any idea?
Please see attached an example.

Thanks in advance!!

Since you are using the fixed function pipeline, have you looked at polygon/line stipple? (glPolygonStipple/glLineStipple)

Ups, isn’t the title editable?. I meant “thick”, of course :wink:

Carsten newmann: Thanks for your reply. The line stippling is not useful because lines can appear very very wide in the screen when the user zooms in. And OpenGL lines, as you know, have a maximum width (in pixels).

[QUOTE=jcurru;1251064]Carsten newmann: Thanks for your reply. The line stippling is not useful because lines can appear very very wide in the screen when the user zooms in. And OpenGL lines, as you know, have a maximum width (in pixels).[/QUOTE] Make the lines thinner as you zoom in.

And that’s a huge problem.

For GIS data and the like we actually calculate each of the line segments for the dashed lines and render the triangles for that. Let me know if you come up with a better way. It is in my plans to look at shaders to solve this problem.

Have a look at the work done here: Wireframe Drawing - nvidia implementation (though in opengl) here: NVIDIA Direct3D SDK 10 Code Samples