don't get how to set it up and can't seem to find any examples of how to do it calling pointLight(...); consecutively only seem to work without the shader being enabled,I know the shader itself works, so there something I am missing with the processing side, any help
`#define PROCESSING_LIGHT_SHADER
define numLights 8
uniform mat4 modelview; uniform mat4 transform; uniform mat3 normalMatrix; uniform vec4 lightPosition[numLights];
// focal factor for specular highlights (positive floats) uniform float SpecularFocus; uniform float SpecularContribution; uniform float DiffuseContribution; uniform vec4 AmbientContribution;
in vec4 vertex;//attribute same as "in" in vec4 color; in vec3 normal;
varying vec4 vertColor;
void main(){ for(int i=0;i<numLights;i++){ gl_Position = transform*vertex; vec3 vertexCamera = vec3(modelview * vertex); vec3 transformedNormal = normalize(normalMatrix * normal); //Vertex normal direction vec3 dir = normalize(lightPosition[i].xyz - vertexCamera); //Vertex to light direction float amountDiffuse = max(0.0, dot(dir, transformedNormal));
// calculate the vertex position in eye coordinates
vec3 vertexViewDir = normalize(-vertexCamera);
// calculate the vector corresponding to the light source reflected in the vertex surface.
// lightDir is negated as GLSL expects an incoming (rather than outgoing) vector
vec3 lightReflection = reflect(-dir, transformedNormal);
// specular light is dot product of light reflection vector and our viewing vector.
// the closer we are to the reflection angle, the greater the specular sheen.
float amountSpecular = max(0.0, dot(lightReflection, vertexViewDir));
// apply an additional pow() to focus the specular effect
// (try playing with this value)
amountSpecular = pow(amountSpecular, SpecularFocus);
color=clamp(color,0.0f,1.0f);
// calculate actual light intensity
float light =AmbientContribution;
light=light+SpecularContribution * amountSpecular + DiffuseContribution * amountDiffuse;
vertColor = vec4(light, light, light, 1) * color;
}
}
`