Шейдеры для работы с прямоугольником

This commit is contained in:
2022-11-23 14:24:49 +03:00
parent 717e083bc0
commit c32a450770
3 changed files with 29 additions and 1 deletions

12
shaders/quad.frag Normal file
View File

@@ -0,0 +1,12 @@
#version 420 core
in vec2 texCoord;
uniform sampler2D tex;
out vec4 color;
void main()
{
color = texture(tex, texCoord);
}

11
shaders/quad.vert Normal file
View File

@@ -0,0 +1,11 @@
#version 420 core
layout(location = 0) in vec3 pos;
out vec2 texCoord;
void main()
{
gl_Position = vec4(pos, 1.0);
texCoord = (pos.xy + vec2(1.0)) / 2; // Переход от [-1;1] к [0;1]
}