add shaders

This commit is contained in:
nek0 2020-12-06 08:14:05 +01:00
parent 5aaa2dd41b
commit 7e3fbd45c7
2 changed files with 37 additions and 0 deletions

17
res/shaders/frag.shader Normal file
View file

@ -0,0 +1,17 @@
#version 330 core
layout(location = 0) out vec4 color;
in vec4 v_color;
in vec2 v_texCoord;
in float v_texIndex;
//uniform sampler2D u_textures[2];
void main()
{
//vec4 texColor = texture(u_texture, v_texCoord);
//int index = int(v_texIndex);
//color = texture(u_textures[index], v_texCoord);
color = vec4(0.0, 1.0, 0.0, 1.0);
}

20
res/shaders/vert.shader Normal file
View file

@ -0,0 +1,20 @@
#version 330 core
layout(location = 0) in vec3 a_position;
layout(location = 1) in vec4 a_color;
layout(location = 2) in vec2 a_texCoord;
layout(location = 3) in float a_texIndex;
out vec4 v_color;
out vec2 v_texCoord;
out float v_texIndex;
uniform mat4 u_mvp;
void main()
{
gl_Position = u_mvp * vec4(a_position, 1);
v_texCoord = a_texCoord;
v_color = a_color;
v_texIndex = a_texIndex;
}