add shaders

This commit is contained in:
nek0 2020-02-06 05:09:16 +01:00
parent 463afc7842
commit 54a12ca7f9
2 changed files with 24 additions and 0 deletions

11
shader/fragment.sl Normal file
View file

@ -0,0 +1,11 @@
#version 330 core
in vec2 TexCoords;
out vec4 color;
uniform sampler2D image;
uniform vec3 spriteColor;
void main()
{
color = vec4(spriteColor, 1.0) * texture(image, TexCoords);
}

13
shader/vertex.sl Normal file
View file

@ -0,0 +1,13 @@
#version 330 core
layout (location = 0) in vec4 vertex; // <vec2 position, vec2 texCoords>
out vec2 TexCoords;
uniform mat4 model;
uniform mat4 projection;
void main()
{
TexCoords = vertex.zw;
gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);
}