blob: 85aab7e06ef2ebc0ae69e2102d7c009a4a35aa38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Draw dashed lines, perforated in screen space.
// Based on a (3D) version by Mike Erwin.
#if __VERSION__ == 120
noperspective varying float distance_along_line;
#define fragColor gl_FragColor
#else
noperspective in float distance_along_line;
out vec4 fragColor;
#endif
uniform float dash_width;
uniform float dash_width_on;
uniform vec4 color1;
uniform vec4 color2;
void main()
{
if (mod(distance_along_line, dash_width) <= dash_width_on) {
fragColor = color1;
} else {
fragColor = color2;
}
}
|