I’ve written OpenGL programs in C++ and Python and all the computer that get this message
vertex shader(s) linked fragment shader(s) linked
show a blank screen. All others that can see the graphics have no messages what so ever from glGetProgramInfoLog()
My laptop shows that message and can’t see anything. A specific example. I have Opengl 3.1 a friend of mine has 3.2 he can’t see anything I always can. He gets that message. This happens on my C++ program too. Is it required to validate the program first? 3 of 7 people can’t see anything and they all get that message. The ones that can see it don’t get a single message from the shader.
Heres everything on my shaders.
def init_shaders(self):
vert_shader=glCreateShader(GL_VERTEX_SHADER)
frag_shader=glCreateShader(GL_FRAGMENT_SHADER)
vert_text="""
varying vec2 texcoord;
attribute vec3 inputvertex;
uniform float ifintex;
attribute vec2 input_texcoord;
void main() {
texcoord = (gl_MultiTexCoord0.xy*ifintex)+input_texcoord.xy;
vec4 position = vec4(inputvertex,1.0);
gl_Position = gl_ModelViewProjectionMatrix * position;
}
"""
frag_text="""
uniform sampler2D texture_map;
uniform vec4 add_color;
varying vec2 texcoord;
void main(){
gl_FragColor = texture2D(texture_map, texcoord.xy)+add_color;
}
"""
glShaderSource(vert_shader,vert_text)
glShaderSource(frag_shader,frag_text)
glCompileShader(vert_shader)
glCompileShader(frag_shader)
self.Shader=glCreateProgram()
glAttachShader(self.Shader,vert_shader)
glAttachShader(self.Shader,frag_shader)
glLinkProgram(self.Shader)
error=glGetProgramInfoLog(self.Shader)
if error!="":
print error
else:
print "Shaders Compiled"
glUseProgram(self.Shader)
Anything wrong? I thought it was just a notification but its all a way too suspicious pattern.
Try specifying that you’re using GLSL 1.20 by adding this to the top of your shaders:
Anything else is probably a minor difference between implementations. I know that on the Intel implementation calling
texture2Dwhen no texture is bound returns(0, 0, 0, 1)while NVIDIA and ATI implementations return(0, 0, 0, 0).Other than that your shaders look fine, try messing around with them on your friends’ machines to see where the issue is.
Also ask your friends what GPU they have to see which implementations are displaying errors.
Oh, and you want to be checking the value of
GL_LINK_STATUSwithglGetProgramivinstead of seeing if the log is empty. Some implementations write to the log on success as well as on failure.GL_LINK_STATUSis always0on success.