B├ęziers on the GPU.
[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 out int objectid;
16
17 void main()
18 {
19         vec2 transformed_position;
20         transformed_position.x = (position.x - bounds_x) / bounds_w;
21         transformed_position.y = (position.y - bounds_y) / bounds_h;
22         // Transform to clip coordinates (-1,1, -1,1).
23         gl_Position.x = (transformed_position.x*2) - 1;
24         gl_Position.y = 1 - (transformed_position.y*2);
25         gl_Position.z = 0.0;
26         gl_Position.w = 1.0;
27
28         objectid = gl_VertexID / 2;
29 }

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