Added vertex attributes.
This commit is contained in:
@@ -2,16 +2,9 @@
|
|||||||
precision mediump float;
|
precision mediump float;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Light color.
|
// Fragment color received from the vertex shader.
|
||||||
uniform vec3 u_lightColor;
|
varying vec4 v_color;
|
||||||
// Diffuse surface color.
|
|
||||||
uniform vec3 u_diffColor;
|
|
||||||
// Specular color.
|
|
||||||
uniform vec3 u_specColor;
|
|
||||||
// Ambient light color.
|
|
||||||
uniform vec3 u_ambColor;
|
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
// TODO: Implement per pixel diffuse lighting.
|
gl_FragColor = v_color;
|
||||||
gl_FragColor = vec4(u_diffColor, 1.0);
|
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,13 @@ uniform mat4 u_projTrans;
|
|||||||
// Vertex position in world coordinates.
|
// Vertex position in world coordinates.
|
||||||
attribute vec4 a_position;
|
attribute vec4 a_position;
|
||||||
|
|
||||||
|
// Vertex color.
|
||||||
|
attribute vec4 a_color;
|
||||||
|
|
||||||
|
// Vertex color to pass to the fragment shader.
|
||||||
|
varying vec4 v_color;
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
|
v_color = a_color;
|
||||||
gl_Position = u_projTrans * a_position;
|
gl_Position = u_projTrans * a_position;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user