Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Dashed thic lines

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    7

    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 ;-)

    Any idea?
    Please see attached an example.

    Thanks in advance!!
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	dashed road.jpg 
Views:	97 
Size:	84.9 KB 
ID:	1033  

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    741
    Since you are using the fixed function pipeline, have you looked at polygon/line stipple? (glPolygonStipple/glLineStipple)

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    7
    Ups, isn't the title editable?. I meant "thick", of course ;-)

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    7
    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.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    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.

  6. #6
    Junior Member Regular Contributor
    Join Date
    Jan 2004
    Location
    .dk
    Posts
    129
    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...SolidWireframe

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •