Optimize text rendering for long strings
This commit is contained in:
parent
678414f014
commit
3b78739efd
3 changed files with 71 additions and 56 deletions
|
|
@ -1,12 +1,18 @@
|
|||
#version 330 core
|
||||
in vec2 texuv;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
uniform sampler2D text;
|
||||
in VS_OUT {
|
||||
vec2 texuv;
|
||||
flat int index;
|
||||
} fs_in;
|
||||
|
||||
uniform sampler2DArray text;
|
||||
uniform int letter_map[400];
|
||||
uniform vec3 text_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, texuv).r);
|
||||
{
|
||||
vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, vec3(fs_in.texuv.xy, letter_map[fs_in.index])).r);
|
||||
color = vec4(text_color, 1.0) * sampled;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue