mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 02:02:14 +02:00
31 lines
746 B
GLSL
31 lines
746 B
GLSL
#version GLSL_VERSION
|
|
#define vleft -1.0
|
|
#define vtop 1.0
|
|
#define vright 1.0
|
|
#define vbottom -1.0
|
|
|
|
#define tleft 0
|
|
#define ttop 1
|
|
#define tright 1
|
|
#define tbottom 0
|
|
|
|
const vec2 viewport_xpos = vec2(vleft, vright);
|
|
const vec2 viewport_ypos = vec2(vtop, vbottom);
|
|
const vec2 texture_xpos = vec2(tleft, tright);
|
|
const vec2 texture_ypos = vec2(ttop, tbottom);
|
|
|
|
const uvec2 pos_map[] = uvec2[4](
|
|
uvec2(1, 0), // right, top
|
|
uvec2(1, 1), // right, bottom
|
|
uvec2(0, 1), // left, bottom
|
|
uvec2(0, 0) // left, top
|
|
);
|
|
|
|
out vec2 texcoord;
|
|
|
|
void main() {
|
|
uvec2 pos = pos_map[gl_VertexID];
|
|
gl_Position = vec4(viewport_xpos[pos[0]], viewport_ypos[pos[1]], 0, 1);
|
|
texcoord = vec2(texture_xpos[pos[0]], texture_ypos[pos[1]]);
|
|
}
|