Uniform locations return -1

Sorry for all the GLSL topics, I’m having bug after bug…

My fragment shader has two uniform samplers:


...
uniform sampler2D t_diffuse;
uniform sampler2D t_specular;
...
 
void main() {
	vec4 diffuse = texture2D(t_diffuse, gl_TexCoord[0].st).rgba;
	vec4 specular = texture2D(t_specular, gl_TexCoord[0].st).rgba;
	...	
   gl_FragColor = specular;
}

I access them with: (Per frame)


   glActiveTexture(GL_TEXTURE0);
	testTexture.bind();
	texLoc = glGetUniformLocation(world.getLightingProgram().programID, "t_diffuse");
	glUniform1f(texLoc,  testTexture.id);
	if(texLoc < 0) System.out.println("Error accessing diffuse: " + texLoc);
			
	glActiveTexture(GL_TEXTURE1);
	testSpecular.bind(); //glBindTexture(GL_TEXTURE_2D, id); - Works...
	texLoc = glGetUniformLocation(world.getLightingProgram().programID, "t_specular");
	glUniform1f(texLoc, testSpecular.id);
   if(texLoc < 0) System.out.println("Error accessing specular: " + texLoc);

And here’s the output:

 Error accessing diffuse: -1

The light shader program ID returns 1. So that works.
The diffuse texture returns 1. (testTexture.id;)
The specular texture return 2. (testSpecular.id;)
But the specular IS working…