aboutsummaryrefslogtreecommitdiffstats
path: root/shaders/rect.vert
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-12-07 15:54:01 +0100
committerDavid Robillard <d@drobilla.net>2019-12-11 22:59:50 +0100
commit13f9ef04aaf5f3583ef83bffc094758f0d640634 (patch)
tree234967ce962d3e1033634569e7a40c80c974abd9 /shaders/rect.vert
parent91773de7ac4e07643fc47f1f0c1fdb6a255f53d2 (diff)
downloadpugl-13f9ef04aaf5f3583ef83bffc094758f0d640634.tar.gz
pugl-13f9ef04aaf5f3583ef83bffc094758f0d640634.tar.bz2
pugl-13f9ef04aaf5f3583ef83bffc094758f0d640634.zip
GL3 Test: Move shaders to separate files
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);
+}