summaryrefslogtreecommitdiffstats
path: root/res/text.f.glsl
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-06-06 13:20:35 -0700
committerJoe Wilm <joe@jwilm.com>2016-06-06 13:20:35 -0700
commited7aa96907e8c5e51facb45f9b590ce25b4f3dd5 (patch)
treedfd2185e57f9ff792d25ae7ca81d56b69e96096d /res/text.f.glsl
parent1f3f9add49d9b6fae8f57bb907b278eb06b513c9 (diff)
Refactor Instanced Drawing to use Vertex Arrays
Per-instanced data was previously stored in uniforms. This required several OpenGL calls to upload all of the data, and it was more complex to prepare (several vecs vs one). Additionally, drawing APIs are now accessible through a `RenderApi` (obtained through `QuadRenderer::with_api`) which enables some RAII patterns. Specifically, checks for batch flushing are handled in Drop.
Diffstat (limited to 'res/text.f.glsl')
-rw-r--r--res/text.f.glsl7
1 files changed, 2 insertions, 5 deletions
diff --git a/res/text.f.glsl b/res/text.f.glsl
index d3265712..d2defb39 100644
--- a/res/text.f.glsl
+++ b/res/text.f.glsl
@@ -1,17 +1,14 @@
#version 330 core
in vec2 TexCoords;
-flat in int InstanceId;
+in vec3 fg;
layout(location = 0, index = 0) out vec4 color;
layout(location = 0, index = 1) out vec4 alphaMask;
uniform sampler2D mask;
-uniform ivec3 textColor[32];
void main()
{
- int i = InstanceId;
alphaMask = vec4(texture(mask, TexCoords).rgb, 1.0);
- vec3 textColorF = vec3(textColor[i]) / vec3(255.0, 255.0, 255.0);
- color = vec4(textColorF, 1.0);
+ color = vec4(fg, 1.0);
}