diff options
author | pryazha <pryadeiniv@mail.ru> | 2025-08-16 10:11:00 +0500 |
---|---|---|
committer | pryazha <pryadeiniv@mail.ru> | 2025-08-16 10:11:00 +0500 |
commit | 1f93c3ef62af6c71217f06491ca2b859d4065740 (patch) | |
tree | 4f07192788df29446aa1ddb73a20839e4ddf9b3f /in_practice/breakout/shaders | |
parent | 99337878eca2807436bcf11d36946b90db44a2d3 (diff) |
in practice chapter
Diffstat (limited to 'in_practice/breakout/shaders')
-rw-r--r-- | in_practice/breakout/shaders/shader.frag | 15 | ||||
-rw-r--r-- | in_practice/breakout/shaders/shader.vert | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/in_practice/breakout/shaders/shader.frag b/in_practice/breakout/shaders/shader.frag new file mode 100644 index 0000000..de96bb9 --- /dev/null +++ b/in_practice/breakout/shaders/shader.frag @@ -0,0 +1,15 @@ +#version 330 core + +in vert_t { + vec2 tex_coords; +} vert; + +out vec4 frag_color; + +uniform sampler2D image; +uniform vec3 color; + +void main() +{ + frag_color = vec4(color, 1.0) * texture(image, vert.tex_coords); +} diff --git a/in_practice/breakout/shaders/shader.vert b/in_practice/breakout/shaders/shader.vert new file mode 100644 index 0000000..043b8c2 --- /dev/null +++ b/in_practice/breakout/shaders/shader.vert @@ -0,0 +1,16 @@ +#version 330 core + +layout (location = 0) in vec4 vertex; + +out vert_t { + vec2 tex_coords; +} vert; + +uniform mat4 model; +uniform mat4 projection; + +void main() +{ + vert.tex_coords = vertex.zw; + gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0); +} |