Шейдеры для работы с прямоугольником
This commit is contained in:
12
shaders/quad.frag
Normal file
12
shaders/quad.frag
Normal 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
11
shaders/quad.vert
Normal 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]
|
||||
}
|
||||
Reference in New Issue
Block a user