Dashed thic lines
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).
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 ;-)
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 ;-)
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).
Last edited by jcurru; 05-24-2013 at 02:51 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.
Tags for this Thread