prosperon/source/shaders/text.sglsl

42 lines
602 B
Plaintext
Raw Normal View History

@vs vs
in vec2 vert;
2024-04-23 15:58:08 -05:00
in vec2 pos;
in vec2 wh;
in vec2 uv;
in vec2 st;
in vec4 vColor;
out vec2 TexCoords;
out vec4 fColor;
uniform vs_params { mat4 projection; };
void main()
{
gl_Position = projection * vec4(pos + (vert * wh), 0.0, 1.0);
TexCoords = uv + vec2(vert.x*st.x, st.y - vert.y*st.y);
fColor = vColor;
}
@end
@fs fs
in vec2 TexCoords;
in vec4 fColor;
out vec4 color;
uniform texture2D text;
uniform sampler smp;
void main()
{
float lettera = texture(sampler2D(text,smp),TexCoords).r;
if (lettera < 0.1f) discard;
color = fColor;
}
@end
@program text vs fs