add shaders
This commit is contained in:
parent
463afc7842
commit
54a12ca7f9
2 changed files with 24 additions and 0 deletions
11
shader/fragment.sl
Normal file
11
shader/fragment.sl
Normal 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
13
shader/vertex.sl
Normal 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);
|
||||||
|
}
|
Loading…
Reference in a new issue