From afece392f74b85f837b4b42d79fe5ba7294db17a Mon Sep 17 00:00:00 2001 From: jgk Date: Fri, 11 Jun 2021 19:41:39 +0200 Subject: [PATCH] Add texture shaders --- shader/texture/simpleWorld.frag | 10 ++++++++++ shader/texture/simpleWorld.vert | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 shader/texture/simpleWorld.frag create mode 100644 shader/texture/simpleWorld.vert diff --git a/shader/texture/simpleWorld.frag b/shader/texture/simpleWorld.frag new file mode 100644 index 000000000..7270697d7 --- /dev/null +++ b/shader/texture/simpleWorld.frag @@ -0,0 +1,10 @@ +#version 430 core +in vec2 vTexPos; +out vec4 fColor; + +uniform sampler2D theTexture; + +void main() +{ + fColor = texture(theTexture, vTexPos); +} diff --git a/shader/texture/simpleWorld.vert b/shader/texture/simpleWorld.vert new file mode 100644 index 000000000..28a0a3996 --- /dev/null +++ b/shader/texture/simpleWorld.vert @@ -0,0 +1,12 @@ +#version 430 core +layout (location = 0) in vec3 pos; +layout (location = 1) in vec2 texPos; +out vec2 vTexPos; + +uniform mat4 worldMat; + +void main() +{ + gl_Position = worldMat * vec4(pos,1); + vTexPos = texPos; +}