blob: 5ed77d77af52671d817c15a63a68670488b8002a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
attribute vec2 position;
attribute vec4 color;
attribute mat4 vMatrix;
uniform mat4 projection;
uniform mat4 model;
varying lowp vec4 VertexColor;
varying lowp vec2 TexCoord;
void main() {
vec4 fragmentPosition = projection * model * vMatrix * vec4(position.x, position.y, 0, 1);
gl_Position = fragmentPosition;
VertexColor = color;
// Normalize the position - the center is at (0,0) and edge vertices are at distance 'radius'
// We want TexCoord to be in the range roughly [-1, 1] at the edges
lowp float maxDist = length(position);
if (maxDist > 0.1) {
TexCoord = position / maxDist;
} else {
TexCoord = vec2(0.0, 0.0);
}
}
|