From e96f339cf4883cece10d9ddc0f66f4d9c0c89a24 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Thu, 26 Jan 2023 02:04:56 +0100 Subject: [PATCH] Cleanup --- src/graphics/graphics.c | 4 ++-- src/shaders/shader.frag | 12 +++++++----- src/shaders/shader.vert | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 10 deletions(-) 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