File: sprite_array.glsl

package info (click to toggle)
python-moderngl-window 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 69,260 kB
  • sloc: python: 11,225; makefile: 20
file content (27 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#version 330

#if defined VERTEX_SHADER

in vec3 in_position;
in vec2 in_texcoord_0;
uniform mat4 projection;
uniform vec2 position;
uniform sampler2DArray texture0;
out vec2 uv0;

void main() {
    gl_Position = projection * vec4(in_position.xy * textureSize(texture0, 0).xy + position, 0, 1);
    uv0 = in_texcoord_0;
}

#elif defined FRAGMENT_SHADER

out vec4 fragColor;
uniform sampler2DArray texture0;
uniform int layer_id;
in vec2 uv0;

void main() {
    fragColor = texture(texture0, vec3(uv0, layer_id));
}
#endif