summaryrefslogtreecommitdiff
path: root/assets/shaders/2d_overlay.vsh
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders/2d_overlay.vsh')
-rw-r--r--assets/shaders/2d_overlay.vsh20
1 files changed, 20 insertions, 0 deletions
diff --git a/assets/shaders/2d_overlay.vsh b/assets/shaders/2d_overlay.vsh
new file mode 100644
index 0000000..512ef91
--- /dev/null
+++ b/assets/shaders/2d_overlay.vsh
@@ -0,0 +1,20 @@
+attribute vec4 in_position;
+attribute vec2 in_texcoord;
+attribute vec2 in_texcoord2;
+
+varying vec2 g_texcoord;
+varying vec2 g_texcoord2;
+uniform vec4 g_screenratio;
+
+void main() {
+ vec2 halfscreen = vec2( 1.0 / g_screenratio[0], 1.0 / g_screenratio[1] );
+
+ vec4 pos = in_position;
+ pos[0] -= halfscreen[0];
+ pos[1] -= halfscreen[1];
+ pos[1] *= -1.0;
+
+ gl_Position = ( pos ) * g_screenratio;
+ g_texcoord = in_texcoord;
+ g_texcoord2 = in_texcoord2;
+}