Original Post
Hi all, Can't figure this one out at all.... I'm trying to send a variable (number of lights) through to the vertex shader. When I call getUniformLocation I get -1 for m_num_lights. m_specular, m_cosine work fine. I want to use the m_num_lights variable in a simple for loop within the shader. Please see C++ code and vertex shader snippets below: C++ code glLinkProgram(m_program); m_texLoc = glGetUniformLocation(m_program, "ColTexture"); m_normLoc = glGetUniformLocation(m_program, "NormTexture"); m_occLoc = glGetUniformLocation(m_program, "OccTexture"); m_cosine = glGetUniformLocation(m_program, "CosinePower"); m_specular = glGetUniformLocation(m_program, "SpecularContribution"); m_num_lights = glGetUniformLocation(m_program, "NumLights"); vertex shader... uniform int NumLights; uniform float CosinePower; uniform float SpecularContribution; void main(void) { int count = NumLights; // loop through all lights in scene.. for( int i=0; i<count; i++ ) { // do some stuff here.. } } any help appreciated. cheers Angry