From 949f4237327b4dcf99e7d4b89e00ec29d266c279 Mon Sep 17 00:00:00 2001 From: Gabriel Pariat Date: Sun, 1 May 2022 17:42:29 -0400 Subject: [PATCH] got a textured cube spinning! --- shaders/shader.frag | 15 +++++++++++++++ shaders/shader.vert | 14 ++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 shaders/shader.frag create mode 100644 shaders/shader.vert diff --git a/shaders/shader.frag b/shaders/shader.frag new file mode 100644 index 0000000..f5a29ee --- /dev/null +++ b/shaders/shader.frag @@ -0,0 +1,15 @@ +#version 330 core +out vec4 FragColor; + +in vec3 ourColor; +in vec2 TexCoord; + +uniform sampler2D texture1; +uniform sampler2D texture2; + +void main() +{ + FragColor = mix(texture(texture1, TexCoord), + texture(texture2, TexCoord), + 0.2); +} diff --git a/shaders/shader.vert b/shaders/shader.vert new file mode 100644 index 0000000..a10ed17 --- /dev/null +++ b/shaders/shader.vert @@ -0,0 +1,14 @@ +#version 330 core +layout (location = 0) in vec3 aPos; +layout (location = 1) in vec2 aTexCoord; + +out vec2 TexCoord; +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +void main() +{ + gl_Position = projection * view * model * vec4(aPos, 1.0); + TexCoord = vec2(aTexCoord.x, aTexCoord.y); +}