From 46f56c104218f675daf2feb1366f53f4d84a1886 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 13 May 2020 17:14:08 +0200 Subject: Very ugly and not working texture --- shader/fragment.glsl | 5 ++++- shader/vertex.glsl | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'shader') diff --git a/shader/fragment.glsl b/shader/fragment.glsl index bf1c286..6c3e1b1 100644 --- a/shader/fragment.glsl +++ b/shader/fragment.glsl @@ -1,10 +1,13 @@ #version 400 core in vec4 v_color; +in vec2 v_texture_coord; out vec4 out_color; +uniform sampler2D u_texture; + void main() { - out_color = v_color; + out_color = v_color + texture(u_texture, v_texture_coord); } diff --git a/shader/vertex.glsl b/shader/vertex.glsl index d46ecd5..b26899e 100644 --- a/shader/vertex.glsl +++ b/shader/vertex.glsl @@ -2,15 +2,18 @@ layout (location = 0) in vec4 in_position; layout (location = 1) in vec4 in_color; +layout (location = 2) in vec2 in_texture_coord; uniform mat4 u_model; uniform mat4 u_view; uniform mat4 u_proj; out vec4 v_color; +out vec2 v_texture_coord; void main() { v_color = in_color; + v_texture_coord = in_texture_coord; gl_Position = u_proj * u_view * u_model * in_position; } -- cgit