From d7fb8dc2f5c5f3fc70b29d1f530782415fce0f44 Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Sat, 28 Oct 2023 23:11:34 +0200 Subject: [PATCH] add test shader for issue #109 --- test/issue_109.glsl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/issue_109.glsl diff --git a/test/issue_109.glsl b/test/issue_109.glsl new file mode 100644 index 00000000..ae622fa5 --- /dev/null +++ b/test/issue_109.glsl @@ -0,0 +1,36 @@ +@ctype mat4 hmm_mat4 + +@vs vs +uniform vs_params { + mat4 mvp; +}; + +in vec4 pos; +in vec2 texcoord0; + +out vec2 uv; + +void main() { + gl_Position = mvp * pos; + uv = texcoord0 * 5.0; +} +@end + +@fs fs +uniform texture2D u_atlas_texture; +uniform texture2D u_atlas_outline; +uniform sampler u_atlas_sampler; + +in vec2 uv; +out vec4 frag_color; + +void main() { + vec2 atlas_size = vec2(textureSize(sampler2D(u_atlas_texture, u_atlas_sampler), 0)); + vec2 v_texture_coord = uv / atlas_size; + vec4 fill = texture(sampler2D(u_atlas_texture, u_atlas_sampler), v_texture_coord); + vec4 outline = texture(sampler2D(u_atlas_outline, u_atlas_sampler), v_texture_coord); + frag_color = fill + outline * (1.0 - fill.a); +} +@end + +@program texcube vs fs