summaryrefslogtreecommitdiff
path: root/source/shaders/ui_text_shader.vs.glsl
diff options
context:
space:
mode:
authortalha <talha@talhaamir.xyz>2024-06-30 22:31:36 +0500
committertalha <talha@talhaamir.xyz>2024-06-30 22:31:36 +0500
commit5ebf4c228b9d26c2b1b32073487413eea6a4c4f2 (patch)
tree0d6a6566f180072954fb3d458a9f552bfbeabeb5 /source/shaders/ui_text_shader.vs.glsl
parent8824908b696278f34891d95c15e519710ea0d18d (diff)
Super simple version of optimized text rendering done
Diffstat (limited to 'source/shaders/ui_text_shader.vs.glsl')
-rw-r--r--source/shaders/ui_text_shader.vs.glsl13
1 files changed, 8 insertions, 5 deletions
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;
}