diff options
author | majortom6 <tombarrett@siu.edu> | 2017-02-19 09:17:35 -0600 |
---|---|---|
committer | Tom Barrett <tombarrett@siu.edu> | 2017-03-07 13:23:41 -0600 |
commit | 5c46e0f0a924989201c6784b0f956bc442f14a7e (patch) | |
tree | 33b5889b872023bd7d414f7baec45706330813b3 /inc/opengl/shaders | |
parent | 2cc21176467d4501adb7bfb9ee03eb9a2a7d14f2 (diff) |
-removed glm library, its in the debian repos
-made opengl and sdl folders in includes, moved various *hpps to them
Diffstat (limited to 'inc/opengl/shaders')
-rw-r--r-- | inc/opengl/shaders/basicshader.frag | 9 | ||||
-rw-r--r-- | inc/opengl/shaders/basicshader.geom | 33 | ||||
-rw-r--r-- | inc/opengl/shaders/basicshader.vert | 15 | ||||
-rw-r--r-- | inc/opengl/shaders/theshader.frag | 7 | ||||
-rw-r--r-- | inc/opengl/shaders/theshader.geom | 24 | ||||
-rw-r--r-- | inc/opengl/shaders/theshader.vert | 15 |
6 files changed, 103 insertions, 0 deletions
diff --git a/inc/opengl/shaders/basicshader.frag b/inc/opengl/shaders/basicshader.frag new file mode 100644 index 0000000..9aa9d0b --- /dev/null +++ b/inc/opengl/shaders/basicshader.frag @@ -0,0 +1,9 @@ +#version 320 es +in highp vec3 fColor; +out highp vec4 outColor; + + +void main() +{ + outColor = vec4(fColor, 1.0); +}
\ No newline at end of file diff --git a/inc/opengl/shaders/basicshader.geom b/inc/opengl/shaders/basicshader.geom new file mode 100644 index 0000000..3540d10 --- /dev/null +++ b/inc/opengl/shaders/basicshader.geom @@ -0,0 +1,33 @@ +#version 320 es
+layout(points) in;
+layout(line_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 (int i = 0; i <= 4; i++) { // Angle between each side in radians
+
+ vec4 offset = vec4(vSides[0] *.8,-vSides[0] *1.1, 0.0, 0.0);
+ if(i==1)
+ offset = vec4(vSides[0] *.8,vSides[0] *1.1, 0.0, 0.0);
+ if(i==2)
+ offset = vec4(-vSides[0] *.8,vSides[0] *1.1, 0.0, 0.0);
+ if(i==3)
+ offset = vec4(-vSides[0] *.8,-vSides[0] *1.1, 0.0, 0.0);
+ if(i==4)
+ offset = vec4(vSides[0] *.8,-vSides[0] *1.1, 0.0, 0.0);
+
+
+ gl_Position = gl_in[0].gl_Position - offset;
+
+ EmitVertex();
+ }
+ EndPrimitive();
+}
diff --git a/inc/opengl/shaders/basicshader.vert b/inc/opengl/shaders/basicshader.vert new file mode 100644 index 0000000..f17aef5 --- /dev/null +++ b/inc/opengl/shaders/basicshader.vert @@ -0,0 +1,15 @@ +#version 320 es +in highp vec2 pos; +in highp vec3 color; +in highp float sides; +uniform mat4 MVP; + +out highp vec3 fColor; +out highp float vSides; + +void main() +{ + gl_Position = MVP * vec4(pos, 0.0, 1.0); + fColor = color; + vSides = sides; +} diff --git a/inc/opengl/shaders/theshader.frag b/inc/opengl/shaders/theshader.frag new file mode 100644 index 0000000..4f870cb --- /dev/null +++ b/inc/opengl/shaders/theshader.frag @@ -0,0 +1,7 @@ +#version 320 es
+in highp vec3 fColor;
+out highp vec4 outColor;
+void main()
+{
+ outColor = vec4(fColor, 1.0);
+}
\ No newline at end of file diff --git a/inc/opengl/shaders/theshader.geom b/inc/opengl/shaders/theshader.geom new file mode 100644 index 0000000..a49e6bc --- /dev/null +++ b/inc/opengl/shaders/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 diff --git a/inc/opengl/shaders/theshader.vert b/inc/opengl/shaders/theshader.vert new file mode 100644 index 0000000..b7cfe3b --- /dev/null +++ b/inc/opengl/shaders/theshader.vert @@ -0,0 +1,15 @@ +#version 320 es
+in highp vec2 pos;
+in highp vec3 color;
+in highp float sides;
+uniform mat4 MVP;
+
+out highp vec3 fColor;
+out highp float vSides;
+
+void main()
+{
+ gl_Position = MVP * vec4(pos, 0.0, 1.0);
+ fColor = color;
+ vSides = sides;
+}
|