   GLSL - "Vertex attribute output count exceeds hardware limits"
  Hey.ive been adding more and more stuff into my shaders and now ive encountered this error ("Vertex attribute output count exceeds hardware limits").Exactly what is "over the hardware limit"? and how do i get around it?. i dont quite understand the error and i cant find much on it googling.Thnx in Advance!   
  This means you have too many varying variables in your shaders. Varyings are interpolated across the triangle, and the graphics card has hard limits on what it can do. If you exceed them, you get the error you described. The only thing you can do then is to use fewer varyings.glGetIntegerv(GL_MAX_VARYING_FLOATS, &n); will tell you how many you can use at most (note that these are floats, so if you interpolate a vec4, that counts as 4!). Generally, all cards must support at least 32 floats (8 4-component interpolants).A similar error can occur with geometry shaders, which have both a soft and a hard limit on the product of primitive vertex count and number of varyings.   ;  um... vertex attributes are not the same as varying variables.read this;  samoth that makes sense since i do have a lot more than 32 varying varuables but now how would i implement for example per pixel lighitng and not use that many varying varuables. here is my current implementation supporting only textures and 8 diffuse point lightsVertex shaderuniform mat4 completeMatrix;uniform mat3 normalMatrix;uniform mat4 modelMatrix;uniform int lightMode;varying vec3 normal;uniform vec3 l0_pos;uniform vec4 l0_color;varying vec4 l0_diffuse;varying vec3 l0_lightDir;varying float l0_dist;uniform vec3 l1_pos;uniform vec4 l1_color;varying vec4 l1_diffuse;varying vec3 l1_lightDir;varying float l1_dist;uniform vec3 l2_pos;uniform vec4 l2_color;varying vec4 l2_diffuse;varying vec3 l2_lightDir;varying float l2_dist;uniform vec3 l3_pos;uniform vec4 l3_color;varying vec4 l3_diffuse;varying vec3 l3_lightDir;varying float l3_dist;uniform vec3 l4_pos;uniform vec4 l4_color;varying vec4 l4_diffuse;varying vec3 l4_lightDir;varying float l4_dist;uniform vec3 l5_pos;uniform vec4 l5_color;varying vec4 l5_diffuse;varying vec3 l5_lightDir;varying float l5_dist;uniform vec3 l6_pos;uniform vec4 l6_color;varying vec4 l6_diffuse;varying vec3 l6_lightDir;varying float l6_dist;uniform vec3 l7_pos;uniform vec4 l7_color;varying vec4 l7_diffuse;varying vec3 l7_lightDir;varying float l7_dist;void main(){gl_Position = completeMatrix * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0;vec4 pos = modelMatrix * gl_Vertex;if (lightMode == 0){l0_diffuse = gl_Color;}else if (lightMode == 1){normal = normalize(normalMatrix*gl_Normal);vec3 aux = vec3(l0_pos.x-pos.x,l0_pos.y-pos.y,l0_pos.z-pos.z);l0_dist = length(aux);l0_lightDir = normalize(aux);l0_diffuse = gl_Color * l0_color;aux = vec3(l1_pos.x-pos.x,l1_pos.y-pos.y,l1_pos.z-pos.z);l1_dist = length(aux);l1_lightDir = normalize(aux);l1_diffuse = gl_Color * l1_color;aux = vec3(l2_pos.x-pos.x,l2_pos.y-pos.y,l2_pos.z-pos.z);l2_dist = length(aux);l2_lightDir = normalize(aux);l2_diffuse = gl_Color * l2_color;aux = vec3(l3_pos.x-pos.x,l3_pos.y-pos.y,l3_pos.z-pos.z);l3_dist = length(aux);l3_lightDir = normalize(aux);l3_diffuse = gl_Color * l3_color;aux = vec3(l4_pos.x-pos.x,l4_pos.y-pos.y,l4_pos.z-pos.z);l4_dist = length(aux);l4_lightDir = normalize(aux);l4_diffuse = gl_Color * l4_color;aux = vec3(l5_pos.x-pos.x,l5_pos.y-pos.y,l5_pos.z-pos.z);l5_dist = length(aux);l5_lightDir = normalize(aux);l5_diffuse = gl_Color * l5_color;aux = vec3(l6_pos.x-pos.x,l6_pos.y-pos.y,l6_pos.z-pos.z);l6_dist = length(aux);l6_lightDir = normalize(aux);l6_diffuse = gl_Color * l6_color;aux = vec3(l7_pos.x-pos.x,l7_pos.y-pos.y,l7_pos.z-pos.z);l7_dist = length(aux);l7_lightDir = normalize(aux);l7_diffuse = gl_Color * l7_color;}else if (lightMode == 2){vec3 aux = vec3(l0_pos.x-pos.x,l0_pos.y-pos.y,l0_pos.z-pos.z);l0_dist = length(aux);l0_diffuse = gl_Color * l0_color;aux = vec3(l1_pos.x-pos.x,l1_pos.y-pos.y,l1_pos.z-pos.z);l1_dist = length(aux);l1_diffuse = gl_Color * l1_color;aux = vec3(l2_pos.x-pos.x,l2_pos.y-pos.y,l2_pos.z-pos.z);l2_dist = length(aux);l2_diffuse = gl_Color * l2_color;aux = vec3(l3_pos.x-pos.x,l3_pos.y-pos.y,l3_pos.z-pos.z);l3_dist = length(aux);l3_diffuse = gl_Color * l3_color;aux = vec3(l4_pos.x-pos.x,l4_pos.y-pos.y,l4_pos.z-pos.z);l4_dist = length(aux);l4_diffuse = gl_Color * l4_color;aux = vec3(l5_pos.x-pos.x,l5_pos.y-pos.y,l5_pos.z-pos.z);l5_dist = length(aux);l5_diffuse = gl_Color * l5_color;aux = vec3(l6_pos.x-pos.x,l6_pos.y-pos.y,l6_pos.z-pos.z);l6_dist = length(aux);l6_diffuse = gl_Color * l6_color;aux = vec3(l7_pos.x-pos.x,l7_pos.y-pos.y,l7_pos.z-pos.z);l7_dist = length(aux);l7_diffuse = gl_Color * l7_color;}}Fragment shaderuniform sampler2D tex;uniform int textureMode;uniform int lightMode;varying vec3 normal;uniform float l0_constantAttenuation;uniform float l0_linearAttenuation;uniform float l0_quadraticAttenuation;varying vec4 l0_diffuse;varying vec3 l0_lightDir;varying float l0_dist;uniform float l1_constantAttenuation;uniform float l1_linearAttenuation;uniform float l1_quadraticAttenuation;varying vec4 l1_diffuse;varying vec3 l1_lightDir;varying float l1_dist;uniform float l2_constantAttenuation;uniform float l2_linearAttenuation;uniform float l2_quadraticAttenuation;varying vec4 l2_diffuse;varying vec3 l2_lightDir;varying float l2_dist;uniform float l3_constantAttenuation;uniform float l3_linearAttenuation;uniform float l3_quadraticAttenuation;varying vec4 l3_diffuse;varying vec3 l3_lightDir;varying float l3_dist;uniform float l4_constantAttenuation;uniform float l4_linearAttenuation;uniform float l4_quadraticAttenuation;varying vec4 l4_diffuse;varying vec3 l4_lightDir;varying float l4_dist;uniform float l5_constantAttenuation;uniform float l5_linearAttenuation;uniform float l5_quadraticAttenuation;varying vec4 l5_diffuse;varying vec3 l5_lightDir;varying float l5_dist;uniform float l6_constantAttenuation;uniform float l6_linearAttenuation;uniform float l6_quadraticAttenuation;varying vec4 l6_diffuse;varying vec3 l6_lightDir;varying float l6_dist;uniform float l7_constantAttenuation;uniform float l7_linearAttenuation;uniform float l7_quadraticAttenuation;varying vec4 l7_diffuse;varying vec3 l7_lightDir;varying float l7_dist;void main (void){vec4 l0_contribution;vec4 l1_contribution;vec4 l2_contribution;vec4 l3_contribution;vec4 l4_contribution;vec4 l5_contribution;vec4 l6_contribution;vec4 l7_contribution;if (textureMode == 0){l0_contribution = l0_diffuse;l1_contribution = l1_diffuse;l2_contribution = l2_diffuse;l3_contribution = l3_diffuse;l4_contribution = l4_diffuse;l5_contribution = l5_diffuse;l6_contribution = l6_diffuse;l7_contribution = l7_diffuse;}else if (textureMode == 1){vec4 texColor = texture2D(tex,gl_TexCoord[0].st);l0_contribution = texColor;l1_contribution = vec4(0,0,0,0);l2_contribution = vec4(0,0,0,0);l3_contribution = vec4(0,0,0,0);l4_contribution = vec4(0,0,0,0);l5_contribution = vec4(0,0,0,0);l6_contribution = vec4(0,0,0,0);l7_contribution = vec4(0,0,0,0);}else if (textureMode == 2){vec4 texColor = texture2D(tex,gl_TexCoord[0].st);l0_contribution = texColor*l0_diffuse;l1_contribution = texColor*l1_diffuse;l2_contribution = texColor*l2_diffuse;l3_contribution = texColor*l3_diffuse;l4_contribution = texColor*l4_diffuse;l5_contribution = texColor*l5_diffuse;l6_contribution = texColor*l6_diffuse;l7_contribution = texColor*l7_diffuse;}   if (lightMode == 0){gl_FragColor = l0_contribution;}else if (lightMode == 1){    vec3 n;   float NdotL;    n = normalize(normal);NdotL = max(dot(n,l0_lightDir),0.0);    float att = 1.0 / (l0_constantAttenuation +l0_linearAttenuation * l0_dist +l0_quadraticAttenuation * l0_dist * l0_dist);l0_contribution = vec4(att*l0_contribution.r*NdotL,att*l0_contribution.g*NdotL,att*l0_contribution.b*NdotL,l0_contribution.a); NdotL = max(dot(n,l1_lightDir),0.0);    att = 1.0 / (l1_constantAttenuation +l1_linearAttenuation * l1_dist +l1_quadraticAttenuation * l1_dist * l1_dist);l1_contribution = vec4(att*l1_contribution.r*NdotL,att*l1_contribution.g*NdotL,att*l1_contribution.b*NdotL,l1_contribution.a); NdotL = max(dot(n,l2_lightDir),0.0);    att = 1.0 / (l2_constantAttenuation +l2_linearAttenuation * l2_dist +l2_quadraticAttenuation * l2_dist * l2_dist);l2_contribution = vec4(att*l2_contribution.r*NdotL,att*l2_contribution.g*NdotL,att*l2_contribution.b*NdotL,l2_contribution.a);NdotL = max(dot(n,l3_lightDir),0.0);    att = 1.0 / (l3_constantAttenuation +l3_linearAttenuation * l3_dist +l3_quadraticAttenuation * l3_dist * l3_dist);l3_contribution = vec4(att*l3_contribution.r*NdotL,att*l3_contribution.g*NdotL,att*l3_contribution.b*NdotL,l3_contribution.a);NdotL = max(dot(n,l4_lightDir),0.0);    att = 1.0 / (l4_constantAttenuation +l4_linearAttenuation * l4_dist +l4_quadraticAttenuation * l4_dist * l4_dist);l4_contribution = vec4(att*l4_contribution.r*NdotL,att*l4_contribution.g*NdotL,att*l4_contribution.b*NdotL,l4_contribution.a);NdotL = max(dot(n,l5_lightDir),0.0);    att = 1.0 / (l5_constantAttenuation +l5_linearAttenuation * l5_dist +l5_quadraticAttenuation * l5_dist * l5_dist);l5_contribution = vec4(att*l5_contribution.r*NdotL,att*l5_contribution.g*NdotL,att*l5_contribution.b*NdotL,l5_contribution.a);NdotL = max(dot(n,l6_lightDir),0.0);    att = 1.0 / (l6_constantAttenuation +l6_linearAttenuation * l6_dist +l6_quadraticAttenuation * l6_dist * l6_dist);l6_contribution = vec4(att*l6_contribution.r*NdotL,att*l6_contribution.g*NdotL,att*l6_contribution.b*NdotL,l6_contribution.a);NdotL = max(dot(n,l7_lightDir),0.0);    att = 1.0 / (l7_constantAttenuation +l7_linearAttenuation * l7_dist +l7_quadraticAttenuation * l7_dist * l7_dist);l7_contribution = vec4(att*l7_contribution.r*NdotL,att*l7_contribution.g*NdotL,att*l7_contribution.b*NdotL,l7_contribution.a);gl_FragColor = l0_contribution+l1_contribution+l2_contribution+l3_contribution+l4_contribution+l5_contribution+l6_contribution+l7_contribution;gl_FragColor.a = l0_contribution.a; }   else if (lightMode == 2)   {   float att = 1.0 / (l0_constantAttenuation +l0_linearAttenuation * l0_dist +l0_quadraticAttenuation * l0_dist * l0_dist);l0_contribution = vec4(att*l0_contribution.r,att*l0_contribution.g,att*l0_contribution.b,l0_contribution.a);  att = 1.0 / (l1_constantAttenuation +l1_linearAttenuation * l1_dist +l1_quadraticAttenuation * l1_dist * l1_dist);l1_contribution = vec4(att*l1_contribution.r,att*l1_contribution.g,att*l1_contribution.b,l1_contribution.a);att = 1.0 / (l2_constantAttenuation +l2_linearAttenuation * l2_dist +l2_quadraticAttenuation * l2_dist * l2_dist);l2_contribution = vec4(att*l2_contribution.r,att*l2_contribution.g,att*l2_contribution.b,l2_contribution.a);   att = 1.0 / (l3_constantAttenuation +l3_linearAttenuation * l3_dist +l3_quadraticAttenuation * l3_dist * l3_dist);l3_contribution = vec4(att*l3_contribution.r,att*l3_contribution.g,att*l3_contribution.b,l3_contribution.a);att = 1.0 / (l4_constantAttenuation +l4_linearAttenuation * l4_dist +l4_quadraticAttenuation * l4_dist * l4_dist);l4_contribution = vec4(att*l4_contribution.r,att*l4_contribution.g,att*l4_contribution.b,l4_contribution.a);att = 1.0 / (l5_constantAttenuation +l5_linearAttenuation * l5_dist +l5_quadraticAttenuation * l5_dist * l5_dist);l5_contribution = vec4(att*l5_contribution.r,att*l5_contribution.g,att*l5_contribution.b,l5_contribution.a);att = 1.0 / (l6_constantAttenuation +l6_linearAttenuation * l6_dist +l6_quadraticAttenuation * l6_dist * l6_dist);l6_contribution = vec4(att*l6_contribution.r,att*l6_contribution.g,att*l6_contribution.b,l6_contribution.a);att = 1.0 / (l7_constantAttenuation +l7_linearAttenuation * l7_dist +l7_quadraticAttenuation * l7_dist * l7_dist);l7_contribution = vec4(att*l7_contribution.r,att*l7_contribution.g,att*l7_contribution.b,l7_contribution.a);gl_FragColor = l0_contribution+l1_contribution+l2_contribution+l3_contribution+l4_contribution+l5_contribution+l6_contribution+l7_contribution;gl_FragColor.a = l0_contribution.a;   }}i based this on a 2 basic glsl lighting tutorials i randomly googled and i extended it myself so i guesed its pretty poorly done but it works fine if i remove 5 of the 8 lights. if this code is any good at all how would i change my implementation of per pixel lighting to reduce the number of varying varuables?Thnx in Advance!   ;  Multi-Pass I believe is what you are looking for. you definitely have a lot of variables in there which are passed in per-vertex, which is why i think its complaining since you say it works when you take out some of the lights.."For example, glBindAttribLocation(ProgramObject, 10, "myAttrib") would bind the attribute "myAttrib" to index 10.The maximum number of attribute locations is limited by the graphics hardware. You can retrieve the maximum supported number of vertex attributes with glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &n)." <-- from Mr's link....Try that.... see what you get.   ;  I'l check that and then il google up some more on "muli-pass".Thnx!   