Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Line thickness

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Newbie Newbie
    Join Date
    Nov 2012

    Line thickness

    I'd like to create line with random thickness using GLSL. But I don't know how to begin (I've started learning GLSL only yestarday).
    Could someone please give some code example.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    If you have only just started shaders check out some "Hello World" shader examples first. Wide lines aren't very hard until you want to do polylines. There are plenty of examples if you google "opengl wide lines"

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2003
    There is no way to control the line thickness from inside a shader. glLineWidth() lets you set a uniform thickness for all line segments, though.

    The only way to achieve varying line thinkness among the various line segments in a single draw call would be to use a geometry shader: turn the line primitives into screen-aligned quads (along the original line) inside the geometry shader. The elongated quads will then look line wide lines and each 'line segment' can have its own thinkness.

  4. #4
    Newbie Newbie
    Join Date
    Nov 2012
    thanks a lot, guys.

Posting Permissions

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