From 74c6854fd8dcbaee736ac0421805ff1e03c4a1e2 Mon Sep 17 00:00:00 2001 From: iamn1ck Date: Sun, 19 Feb 2017 07:00:34 -0600 Subject: -quadtree and opengl rendering are now in the master branch ! -using sdl_rect for location and size ended up being not so great due to it not having floats, so we reverted back to using location -much, much refractoring is now needed --- inc/opengl/theshader.geom | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 inc/opengl/theshader.geom (limited to 'inc/opengl/theshader.geom') diff --git a/inc/opengl/theshader.geom b/inc/opengl/theshader.geom new file mode 100644 index 0000000..a49e6bc --- /dev/null +++ b/inc/opengl/theshader.geom @@ -0,0 +1,24 @@ +#version 320 es +layout(points) in; +layout(triangle_strip, max_vertices = 64) out; + +in highp vec3 vColor[]; +in highp float vSides[]; +out highp vec3 fColor; + +const float PI = 3.1415926; + +void main() +{ + fColor = vColor[0]; + + for (float i = 0.0; i <= vSides[0]; i+=1.0) { // Angle between each side in radians + float ang = PI * 2.0 / vSides[0] * i; + // Offset from center of point (0.3 to accomodate for aspect ratio) + vec4 offset = vec4(cos(ang) * 0.3, -sin(ang) * 0.4, 0.0, 0.0); + gl_Position = gl_in[0].gl_Position - offset; + + EmitVertex(); + } + EndPrimitive(); +} \ No newline at end of file -- cgit v1.2.3