diff --git a/src/graphics/graphics.c b/src/graphics/graphics.c index af77a1c..0bbe794 100644 --- a/src/graphics/graphics.c +++ b/src/graphics/graphics.c @@ -35,8 +35,8 @@ #include "../../include/base.h" #include "../../include/ui.h" -#define VERTEX_SHADER_FILE "data/shader.vert" -#define FRAG_SHADER_FILE "data/shader.frag" +#define VERTEX_SHADER_FILE "src/shaders/shader.vert" +#define FRAG_SHADER_FILE "src/shaders/shader.frag" /* -------------------------------------------------------------------------- */ diff --git a/src/shaders/shader.frag b/src/shaders/shader.frag index 3c14ed2..fb8a76c 100644 --- a/src/shaders/shader.frag +++ b/src/shaders/shader.frag @@ -1,7 +1,9 @@ -uniform vec2 resolution; +#version 330 core -void main() +in vec4 color; +out vec4 out_frag_color; + +void main(void) { - gl_FragColor = vec4(gl_FragCoord.x / resolution.x,1,1,1); -} - + out_frag_color = color; +} \ No newline at end of file diff --git a/src/shaders/shader.vert b/src/shaders/shader.vert index 1e37e40..588e6fa 100644 --- a/src/shaders/shader.vert +++ b/src/shaders/shader.vert @@ -1,4 +1,16 @@ - void main() +#version 330 core + +uniform mat4 projection_matrix; +uniform mat4 model_matrix; +uniform mat4 view_matrix; + +layout(location=0) in vec3 in_position; +layout(location=1) in vec3 in_color; + +out vec4 color; + +void main(void) { - gl_Position = ftransform(); -} + gl_Position = projection_matrix * view_matrix * model_matrix * vec4(in_position, 1); + color = vec4(1 * in_color.rgb, 1); +} \ No newline at end of file