summaryrefslogtreecommitdiff
path: root/inc/opengl/theshader.geom
diff options
context:
space:
mode:
authoriamn1ck <iamn1ck@yahoo.com>2017-02-19 07:00:34 -0600
committerTom Barrett <tombarrett@siu.edu>2017-03-07 13:22:46 -0600
commit74c6854fd8dcbaee736ac0421805ff1e03c4a1e2 (patch)
tree4a3ae40bea9b07a2111128e98d9272bdbac2af87 /inc/opengl/theshader.geom
parent03885192b9ff7d3c5e2dcfd98aefd21e9b62f603 (diff)
-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
Diffstat (limited to 'inc/opengl/theshader.geom')
-rw-r--r--inc/opengl/theshader.geom24
1 files changed, 24 insertions, 0 deletions
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