Terrible hacky SolveCubic.
[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         float pixel_x;
12         float pixel_y;
13         float pixel_w;
14         float pixel_h;
15 };
16
17 layout(location = 0) in vec2 position;
18
19 out int objectid;
20 out vec2 pixsize;
21
22 void main()
23 {
24         vec2 transformed_position;
25         transformed_position.x = (position.x - bounds_x) / bounds_w;
26         transformed_position.y = (position.y - bounds_y) / bounds_h;
27         // Transform to clip coordinates (-1,1, -1,1).
28         gl_Position.x = (transformed_position.x*2) - 1;
29         gl_Position.y = 1 - (transformed_position.y*2);
30         gl_Position.z = 0.0;
31         gl_Position.w = 1.0;
32         pixsize = vec2(pixel_w/bounds_w, 100*pixel_h/bounds_h);
33         objectid = gl_VertexID / 2;
34 }

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