diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-01-17 16:52:41 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-01-17 16:52:41 +0100 |
commit | 8443687092ef95f7eb73c5020fb8d47153a68ee7 (patch) | |
tree | d21c200e3f75c60df36b7455dba25fad33c79216 /src/shader/outline.vertex.glsl | |
parent | 509b223fbf63ea326b60e82dec2f0c0cdb160a66 (diff) | |
download | qtlocation-mapboxgl-8443687092ef95f7eb73c5020fb8d47153a68ee7.tar.gz |
add antialiased line shader
Diffstat (limited to 'src/shader/outline.vertex.glsl')
-rw-r--r-- | src/shader/outline.vertex.glsl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shader/outline.vertex.glsl b/src/shader/outline.vertex.glsl new file mode 100644 index 0000000000..c3d608fd70 --- /dev/null +++ b/src/shader/outline.vertex.glsl @@ -0,0 +1,15 @@ +attribute vec2 a_pos; +uniform mat4 u_matrix; +uniform vec2 u_world; + +varying vec2 v_pos; + +void main() { + // If the x coordinate is the maximum integer, we move the z coordinates out + // of the view plane so that the triangle gets clipped. This makes it easier + // for us to create degenerate triangle strips. + float z = step(32767.0, a_pos.x) * 2.0; + gl_Position = u_matrix * vec4(a_pos, z, 1); + + v_pos = (gl_Position.xy + 1.0) / 2.0 * u_world; +} |