diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-12 16:36:56 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-12 16:36:56 +0100 |
| commit | ee1d1eb500349423599c3a317d97dd5fe0d75580 (patch) | |
| tree | 084e9ac856039a9c4b673f47ea160a47d621060a /assets/text.glsl | |
| parent | 2757509bffc84cb912e438e74d9bcdfb1d2c5e68 (diff) | |
working on compiling shaders
Diffstat (limited to 'assets/text.glsl')
| -rw-r--r-- | assets/text.glsl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/assets/text.glsl b/assets/text.glsl index e69de29..3b6ed18 100644 --- a/assets/text.glsl +++ b/assets/text.glsl @@ -0,0 +1,38 @@ +@header #include "cglm/cglm.h" + +@vs vs_text +in vec2 in_position; +in vec2 in_uv; + +layout(binding = 0) uniform vs_text_params { + mat4 mvp; + vec4 color; +} + +out vec2 out_uv; +out vec4 out_color; + +void main() { + gl_Position = mvp * vec4(in_position, 0.0, 1.0); + out_uv = in_uv; + out_color = color; +} + +@end + +@fs fs_text +layout(binding = 0) uniform texture2D u_texture; +layout(binding = 1) uniform sampler u_sampler; + +in vec2 in_uv; +in vec4 in_color; + +out vec4 out_color; + +void main() { + float alpha = texture(sampler2D(u_texture, u_sampler), in_uv).r; + out_color = vec4(in_color.rgb, in_color.a * alpha); +} + +@end +@program text vs_text fs_text
\ No newline at end of file |
