aboutsummaryrefslogtreecommitdiffstats
path: root/Shaders
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-18 12:07:48 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-18 12:07:48 -0400
commitec0ab456cf869f2daa6dea41158c54da745626d8 (patch)
tree85d9c23774ffee6d7608782dac3086e15e1efc90 /Shaders
parent2cedd39a90fdb0387783b50446b16732517fb651 (diff)
Added basic UI shaders
Diffstat (limited to 'Shaders')
-rw-r--r--Shaders/ui.frag12
-rw-r--r--Shaders/ui.vert14
2 files changed, 26 insertions, 0 deletions
diff --git a/Shaders/ui.frag b/Shaders/ui.frag
new file mode 100644
index 0000000..737344e
--- /dev/null
+++ b/Shaders/ui.frag
@@ -0,0 +1,12 @@
+uniform sampler2D sampler;
+
+varying vec2 texCoord;
+varying vec4 color;
+
+void main(){
+ vec4 pixelColor = texture2D(sampler, vec2(texCoord.x, texCoord.y));
+ //TODO allow antialiasing
+ //if (pixelColor.w != 1.0f)
+ // discard;
+ gl_FragColor = pixelColor * color;
+}
diff --git a/Shaders/ui.vert b/Shaders/ui.vert
new file mode 100644
index 0000000..b2fcba4
--- /dev/null
+++ b/Shaders/ui.vert
@@ -0,0 +1,14 @@
+attribute vec3 coord2d;
+attribute vec2 tex_coord;
+
+uniform mat4 ortho;
+uniform vec4 tex_color;
+
+varying vec2 texCoord;
+varying vec4 color;
+
+void main(){
+ texCoord = tex_coord;
+ color = tex_color;
+ gl_Position = ortho * vec4(coord2d.xyz, 1.0);
+}