diff --git a/shaders/shader.frag b/shaders/shader.frag index 3f0ad51..801807d 100644 --- a/shaders/shader.frag +++ b/shaders/shader.frag @@ -1,8 +1,13 @@ #version 330 core -out vec3 color; +in vec2 texCoord; + +uniform sampler2D tex_diffuse; + +out vec4 color; void main() { - color = vec3(1, 0, 0); + color = texture(tex_diffuse, texCoord); } + \ No newline at end of file diff --git a/shaders/shader.vert b/shaders/shader.vert index 8a67d4d..caca2c7 100644 --- a/shaders/shader.vert +++ b/shaders/shader.vert @@ -1,11 +1,15 @@ #version 330 core layout(location = 0) in vec3 pos; +layout(location = 1) in vec2 inTexCoord; uniform mat4 vp; uniform mat4 model; +out vec2 texCoord; + void main() { gl_Position = vp * model * vec4(pos, 1.0); + texCoord = inTexCoord; }