diff options
Diffstat (limited to 'resources/shaders/anchorPoint.geom')
-rw-r--r-- | resources/shaders/anchorPoint.geom | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/resources/shaders/anchorPoint.geom b/resources/shaders/anchorPoint.geom new file mode 100644 index 0000000..ccb6b84 --- /dev/null +++ b/resources/shaders/anchorPoint.geom @@ -0,0 +1,41 @@ +#version 330 core + +layout(points) in; +layout (triangle_strip, max_vertices = 4) out; + +in vec4 vColor[]; +out vec4 fColor; +out vec2 fPoint; +out float fRadius; + +uniform int width; +uniform int height; +uniform float vSize; + +void main() { + vec4 offset = vec4(vSize, -vSize, 0.0, 0.0); + + int i; + for (i = 0; i < gl_in.length(); i ++) { + vec4 p = gl_in[i].gl_Position; + + fColor = vColor[i]; + fPoint = vec2((p.x * 0.5 + 0.5) * width, + (p.y * 0.5 + 0.5) * height); + fRadius = vSize; + + gl_Position = p + offset.yxzw; + EmitVertex(); + + gl_Position = p + offset.yyzw; + EmitVertex(); + + gl_Position = p + offset.xxzw; + EmitVertex(); + + gl_Position = p + offset.xyzw; + EmitVertex(); + + EndPrimitive(); + } +} |