From 51183a2cf10bfb8b161d4672eff56ef1a75dcf52 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 May 2014 16:42:14 -0430 Subject: [PATCH] Added vertex attributes. --- .../singleDiffuseLight/singleDiffuseLight_frag.glsl | 13 +++---------- .../singleDiffuseLight/singleDiffuseLight_vert.glsl | 7 +++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/shaders/singleDiffuseLight/singleDiffuseLight_frag.glsl b/assets/shaders/singleDiffuseLight/singleDiffuseLight_frag.glsl index d1cb398..aed8177 100644 --- a/assets/shaders/singleDiffuseLight/singleDiffuseLight_frag.glsl +++ b/assets/shaders/singleDiffuseLight/singleDiffuseLight_frag.glsl @@ -2,16 +2,9 @@ precision mediump float; #endif -// Light color. -uniform vec3 u_lightColor; -// Diffuse surface color. -uniform vec3 u_diffColor; -// Specular color. -uniform vec3 u_specColor; -// Ambient light color. -uniform vec3 u_ambColor; +// Fragment color received from the vertex shader. +varying vec4 v_color; void main(){ - // TODO: Implement per pixel diffuse lighting. - gl_FragColor = vec4(u_diffColor, 1.0); + gl_FragColor = v_color; } diff --git a/assets/shaders/singleDiffuseLight/singleDiffuseLight_vert.glsl b/assets/shaders/singleDiffuseLight/singleDiffuseLight_vert.glsl index 7098fe7..2a2b274 100644 --- a/assets/shaders/singleDiffuseLight/singleDiffuseLight_vert.glsl +++ b/assets/shaders/singleDiffuseLight/singleDiffuseLight_vert.glsl @@ -4,6 +4,13 @@ uniform mat4 u_projTrans; // Vertex position in world coordinates. attribute vec4 a_position; +// Vertex color. +attribute vec4 a_color; + +// Vertex color to pass to the fragment shader. +varying vec4 v_color; + void main(){ + v_color = a_color; gl_Position = u_projTrans * a_position; }