aboutsummaryrefslogtreecommitdiffstats
path: root/shaders/rect.vert
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/rect.vert')
-rw-r--r--shaders/rect.vert18
1 files changed, 18 insertions, 0 deletions
diff --git a/shaders/rect.vert b/shaders/rect.vert
new file mode 100644
index 0000000..34fe0b3
--- /dev/null
+++ b/shaders/rect.vert
@@ -0,0 +1,18 @@
+#version 330
+
+/* The vertex shader is trivial, but forwards scaled UV coordinates (in pixels)
+ to the fragment shader for drawing the border. */
+
+uniform mat4 MVP;
+uniform vec2 u_size;
+
+in vec2 v_position;
+
+noperspective out vec2 f_uv;
+
+void
+main()
+{
+ f_uv = v_position * u_size;
+ gl_Position = MVP * vec4(v_position, 0.0, 1.0);
+}