Adding a directional light to a transforming cube in vanilla wegl
问题 How can I add a direction light to a transforming cube in webGL. I know it requires normals and i've add them in the snippet (i've commented them out) It will also require some math in the vertex shader. unfortunatly this code doesnt work when i uncomment. attribute vec4 coords; uniform mat4 transformMatrix; attribute vec3 normal; attribute vec4 colors; uniform vec3 lightColor; uniform vec3 lightDirection; varying vec4 varyingColors; uniform mat4 perspectiveMatrix; void main(void) { vec3 norm