From 90e85b2fe655a2643535b0f49d99836ac72e724c Mon Sep 17 00:00:00 2001 From: iurii plugatarov Date: Sat, 10 Aug 2024 15:22:45 +0300 Subject: custom shader loader --- src/shaders/triangle.frag.glsl | 5 +++-- src/shaders/triangle.vert.glsl | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/shaders') diff --git a/src/shaders/triangle.frag.glsl b/src/shaders/triangle.frag.glsl index 664c399..b3dcd05 100644 --- a/src/shaders/triangle.frag.glsl +++ b/src/shaders/triangle.frag.glsl @@ -1,6 +1,7 @@ #version 330 core out vec4 FragColor; +in vec3 ourColor; void main() { - FragColor = vec4(1.0, 0.0, 0.0, 1.0); -} + FragColor = vec4(ourColor, 1.0); +} diff --git a/src/shaders/triangle.vert.glsl b/src/shaders/triangle.vert.glsl index dbef13e..f1dbe00 100644 --- a/src/shaders/triangle.vert.glsl +++ b/src/shaders/triangle.vert.glsl @@ -1,6 +1,9 @@ #version 330 core -layout (location = 0) in vec2 aPos; +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec3 aColor; +out vec3 ourColor; void main() { - gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); + gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0); + ourColor = aColor; } -- cgit 1.4.1-2-gfad0