GLSL Shaders -> Files (instead of #define)
[ipdf/code.git] / src / shaders / rect_vert.glsl
1 #version 140
2 #extension GL_ARB_shading_language_420pack : require
3 #extension GL_ARB_explicit_attrib_location : require
4
5 layout(std140, binding=0) uniform ViewBounds
6 {
7         float bounds_x;
8         float bounds_y;
9         float bounds_w;
10         float bounds_h;
11 };
12
13 layout(location = 0) in vec2 position;
14
15 void main()
16 {
17         vec2 transformed_position;
18         transformed_position.x = (position.x - bounds_x) / bounds_w;
19         transformed_position.y = (position.y - bounds_y) / bounds_h;
20         // Transform to clip coordinates (-1,1, -1,1).
21         gl_Position.x = (transformed_position.x*2) - 1;
22         gl_Position.y = 1 - (transformed_position.y*2);
23         gl_Position.z = 0.0;
24         gl_Position.w = 1.0;
25 }

UCC git Repository :: git.ucc.asn.au