Graphics Programs Reference
In-Depth Information
+ "uniform mat4 uMV; \n"
+ "uniform mat4 uMVP; \n"
+ "uniform mat4 uMVLight; \n"
+ "const vec4 lightPositionWorld = vec4(10.0, 10.0,
0.0, 1.0); \n"
+ "void main() { \n"
+ " float diffuseIntensity; \n"
+ " vec4 vertexEye = vec4(uMV * vertex); \n"
+ " vec4 lightPositionEye = vec4(uMVLight *
lightPositionWorld); \n"
+ " vec3 ds = normalize(vec3(lightPositionEye -
vertexEye)); \n"
+ " \n"
+ " diffuseIntensity = max(dot(ds, normal), 0.210);
\n"
+ " diffuseIntensity = 0.570 * 0.210 *
diffuseIntensity; \n"
+ " vec3 diffuse = vec3(diffuseIntensity); \n"
+ " // vec4 materialColor = vec4(0.1, 0.1, 0.25,
1.0); \n"
+ " // gl_FragColor = vec4(0.1, 0.1, 0.25, 1.0) +
vec4(diffuse, 1.0); \n"
+ " gl_FragColor = vec4(diffuse, 1.0); \n"
+ "} \n";
Search WWH ::




Custom Search