I have been figuring out how to use sampler2D uniforms but get the above error even though the shader validates and the program does what is is supposed... blend a given color with the texel color. The relevant code follows:
vertex shader:
varying vec4 vertColor;
void main(){
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
vertColor = vec4(0.6, 0.3, 0.4, 1.0);
gl_TexCoord[0]=gl_MultiTexCoord0;
}
fragment shader
uniform sampler2D tex;
varying vec4 vertColor;
void main(){
gl_FragColor = vertColor*texture2D(tex, gl_TexCoord[0].st);
}
lwjgl code in the render method:
if(useShader){
ARBShaderObjects.glUseProgramObjectARB(shader);
}
int location=ARBShaderObjects.glGetUniformLocationARB(shader, "tex");
if(location>0){
ARBShaderObjects.glUniform1iARB(location, 0);
GL13.glActiveTexture(GL13.GL_TEXTURE0);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex);
}else{
ARBShaderObjects.glUseProgramObjectARB(0);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex);
}
GL11.glBegin(GL11.GL_QUADS); // Draw A Quad
Having spend days trawling through what examples there are on the net I think I have the code right but still receive the warning. I am on a Radeon 5600 series.
Do you found problem?