dashed_lines.fs 427 B

1234567891011121314151617181920
  1. #version 100
  2. precision highp float;
  3. // see as reference: https://stackoverflow.com/questions/52928678/dashed-line-in-opengl3
  4. uniform float dash_size;
  5. uniform float gap_size;
  6. uniform vec4 uniform_color;
  7. varying float coord_s;
  8. void main()
  9. {
  10. float inv_stride = 1.0 / (dash_size + gap_size);
  11. if (gap_size > 0.0 && fract(coord_s * inv_stride) > dash_size * inv_stride)
  12. discard;
  13. gl_FragColor = uniform_color;
  14. }