From 5ebf4c228b9d26c2b1b32073487413eea6a4c4f2 Mon Sep 17 00:00:00 2001 From: talha Date: Sun, 30 Jun 2024 22:31:36 +0500 Subject: Super simple version of optimized text rendering done --- source/shaders/ui_text_shader.vs.glsl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source/shaders/ui_text_shader.vs.glsl') diff --git a/source/shaders/ui_text_shader.vs.glsl b/source/shaders/ui_text_shader.vs.glsl index ecaefa4..363833e 100644 --- a/source/shaders/ui_text_shader.vs.glsl +++ b/source/shaders/ui_text_shader.vs.glsl @@ -1,12 +1,15 @@ #version 330 core -layout(location=0) in vec3 aPos; -layout(location=1) in vec2 aTex; +layout(location=0) in vec2 aPos; uniform mat4 Projection; - +uniform mat4 LetterTransforms[32]; out vec2 TexCoords; +flat out int Index; void main() { - gl_Position = Projection * vec4(aPos, 1.0); - TexCoords = aTex; + gl_Position = Projection * LetterTransforms[gl_InstanceID] * vec4(aPos, 0.0, 1.0); + vec2 tex = aPos; + TexCoords = tex; + TexCoords.y = 1.0 - TexCoords.y; + Index = gl_InstanceID; } -- cgit v1.2.3