summaryrefslogtreecommitdiff
path: root/assets/shaders/2d.vsh
blob: 77010875ce064e14b7bf0b60f637b05e09c91c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#version 150

in vec2 in_pos;
in vec2 in_texcoord;
in vec4 in_col;

out vec2 g_texcoord;
out vec4 g_color;

uniform vec4 g_screenratio;

void main() {
  vec2 halfscreen = vec2( 1.0 / g_screenratio[0], 1.0 / g_screenratio[1] );

  vec4 pos = vec4( in_pos.x, in_pos.y, 1, 1 );
  pos[0] -= halfscreen[0];
  pos[1] -= halfscreen[1];
  pos[1] *= -1.0;

	gl_Position = ( pos ) * g_screenratio;
	g_texcoord = in_texcoord;
	g_color = in_col;
}