Skip to content

Commit

Permalink
add test shader for issue #109
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Oct 28, 2023
1 parent 9cdfb42 commit d7fb8dc
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/issue_109.glsl
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d7fb8dc

Please sign in to comment.