alacritty::renderer::text::gles2

Constant TEXT_SHADER_V

Source
const TEXT_SHADER_V: &str = "// Cell coords.\nattribute vec2 cellCoords;\n\n// Glyph coords.\nattribute vec2 glyphCoords;\n\n// uv mapping.\nattribute vec2 uv;\n\n// Text foreground rgb packed together with cell flags. textColor.a\n// are the bitflags; consult RenderingGlyphFlags in renderer/mod.rs\n// for the possible values.\nattribute vec4 textColor;\n\n// Background color.\nattribute vec4 backgroundColor;\n\nvarying vec2 TexCoords;\nvarying vec3 fg;\nvarying float colored;\nvarying vec4 bg;\n\nuniform highp int renderingPass;\nuniform vec4 projection;\n\nvoid main() {\n    vec2 projectionOffset = projection.xy;\n    vec2 projectionScale = projection.zw;\n\n    vec2 position;\n    if (renderingPass == 0) {\n        TexCoords = vec2(0, 0);\n        position = cellCoords;\n    } else {\n        TexCoords = uv;\n        position = glyphCoords;\n    }\n\n    fg = vec3(float(textColor.r), float(textColor.g), float(textColor.b)) / 255.;\n    colored = float(textColor.a);\n    bg = vec4(float(backgroundColor.r), float(backgroundColor.g), float(backgroundColor.b),\n            float(backgroundColor.a)) / 255.;\n\n    vec2 finalPosition = projectionOffset + position * projectionScale;\n    gl_Position = vec4(finalPosition, 0., 1.);\n}\n";