1
0
Fork 0
2022-untitled-game/code/shaders/text.glsl

42 lines
828 B
Plaintext
Raw Permalink Normal View History

2022-08-01 23:11:10 +00:00
//////////////////////////////////////////////////////////////////////////////
#ifdef VERTEX
layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec2 a_texcoord;
out vec2 v_texcoord;
uniform mat4 u_proj;
uniform mat4 u_model;
void main()
{
gl_Position = u_proj * u_model * vec4(a_pos, 0.0f, 1.0f);
v_texcoord = a_texcoord;
}
#endif
//////////////////////////////////////////////////////////////////////////////
#ifdef FRAGMENT
in vec2 v_texcoord;
out vec4 f_color;
uniform sampler2D u_texture;
uniform vec3 u_color;
void main()
{
// 8-bit value is stored in Red value; interpret as alpha for blending
vec4 value = vec4(1.0f, 1.0f, 1.0f, texture(u_texture, v_texcoord).r);
f_color = vec4(u_color, 1.0f) * value;
}
#endif
//////////////////////////////////////////////////////////////////////////////