Fix rendering of horizontal borders

This commit is contained in:
Kovid Goyal 2017-09-11 15:45:30 +05:30
parent 2a24199c90
commit 1e37041b50
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -17,8 +17,11 @@ const uvec2 pos_map[] = uvec2[4](
uvec2(LEFT, TOP) uvec2(LEFT, TOP)
); );
float to_opengl(uint val, uint sz) { vec2 to_opengl(uint x, uint y) {
return -1.0 + 2.0 * (float(val) / float(sz)); return vec2(
-1.0 + 2.0 * (float(x) / float(viewport.x)),
1.0 - 2.0 * (float(y) / float(viewport.y))
);
} }
float to_color(uint c) { float to_color(uint c) {
@ -27,6 +30,6 @@ float to_color(uint c) {
void main() { void main() {
uvec2 pos = pos_map[gl_VertexID]; uvec2 pos = pos_map[gl_VertexID];
gl_Position = vec4(to_opengl(rect[pos.x], viewport.x), to_opengl(rect[pos.y], viewport.y), 0, 1); gl_Position = vec4(to_opengl(rect[pos.x], rect[pos.y]), 0, 1);
color = vec3(to_color(rect_color >> 16), to_color(rect_color >> 8), to_color(rect_color)); color = vec3(to_color(rect_color >> 16), to_color(rect_color >> 8), to_color(rect_color));
} }