Overhauls text rendering to improve performance. Renderer was really ineffient, sending a separate GPU draw call for every character rendered. This created a bottleneck, especially with text-heavy UI stuff like the wallpaper. - The 'TextRenderer' now generates a single texture atlas for all font glyhs on load so all characters share a single texture. - 'begin()' / 'flush()' was added to the 'TextRenderer'. Calls to 'render_text' now buffer vertex data (position, texture coords, colour) instead of drawing immediately. A single 'flush()' call at the end of a pass draws all buffered text in one draw call. - A simple batching introduced some shitty visual layering bugs. to solve this, a staged flushing architecture has been implemented. Each logical UI component is now responsible for managing its own rendering passes, beginning and flushing text batches as needed to ensure correct back-to-front layering.
16 lines
320 B
GLSL
16 lines
320 B
GLSL
#version 330 core
|
|
layout (location = 0) in vec2 aPos;
|
|
layout (location = 1) in vec2 aTexCoords;
|
|
layout (location = 2) in vec3 aColor;
|
|
|
|
out vec2 TexCoords;
|
|
out vec3 ourColor;
|
|
|
|
uniform mat4 projection;
|
|
|
|
void main() {
|
|
gl_Position = projection * vec4(aPos, 0.0, 1.0);
|
|
TexCoords = aTexCoords;
|
|
ourColor = aColor;
|
|
}
|