PDA

View Full Version : Dashed thic lines



jcurru
05-24-2013, 12:38 PM
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 ;-)

Any idea?
Please see attached an example.

Thanks in advance!!

carsten neumann
05-24-2013, 02:09 PM
Since you are using the fixed function pipeline, have you looked at polygon/line stipple? (glPolygonStipple (http://www.opengl.org/sdk/docs/man2/xhtml/glPolygonStipple.xml)/glLineStipple (http://www.opengl.org/sdk/docs/man2/xhtml/glLineStipple.xml))

jcurru
05-24-2013, 02:14 PM
Ups, isn't the title editable?. I meant "thick", of course ;-)

jcurru
05-24-2013, 02:16 PM
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).

tonyo_au
05-24-2013, 09:08 PM
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.

Mikkel Gjoel
05-27-2013, 06:30 AM
Have a look at the work done here: http://www2.compute.dtu.dk/~janba/Wireframe/ - nvidia implementation (though in opengl) here: http://developer.download.nvidia.com/SDK/10.5/direct3d/samples.html#SolidWireframe