PDA

View Full Version : shader program link error with no info log



blackbird
07-03-2011, 08:52 AM
I have a shader program which works well on my machine
but when I run it on another machine, the linker failed to link the program:


GLint ret;
glLinkProgram(hProgram);
glGetProgramiv(hProgram,GL_LINK_STATUS,&ret);

The returned value is GL_FALSE. Then I tried to find out what's wrong:


GLint length;
glGetShaderiv(hProgram,GL_INFO_LOG_LENGTH,&length) ;

The GL_INFO_LOG_LENGTH is 0, which means no log info.

What should I do to fixed the problem?

Ffelagund
07-03-2011, 01:19 PM
Could you be more explicit? Doed the shaders compilation throw any error? Are your shader handles valid handles? That kind of information would be useful.

blackbird
07-03-2011, 08:45 PM
Could you be more explicit? Doed the shaders compilation throw any error? Are your shader handles valid handles? That kind of information would be useful.

The compilation of vertex shader and fragment shader is OK, I think. glGetShaderiv called with GL_COMPILE_STATUS return GL_TRUE, but I didn't check with glGetError (I will try it)

The code is part of a game, which runs well on my PC (NVidia chipset, support OpenGL 3.3) and my netbook (ATI, OpenGL 3.2), and one of my friends' notebook (ATI, OpenGL 3.0), but failed on another notebook (NVidia, OpenGL 2.1). So I don't think it's caused by errors such as invalid handle.

The shader program initially is #version 140, and I rewrited it as #version 110 for hardware compatible. I have test it on on a super old PC (NVidia, OpenGL 2.0), the compilation and linkage works OK, too (though with orther problems need to be settled).

I think something is wrong with the shader program, and I need a way to debug it. The problem is no log, no cues...

mobeen
07-04-2011, 12:53 AM
Could u check for the support of the required extensions first using GLEE or glew to make sure that the hardware u r working on supports the extension u r using.

blackbird
07-04-2011, 02:19 AM
Could u check for the support of the required extensions first using GLEE or glew to make sure that the hardware u r working on supports the extension u r using.

Actually I have done it by GLEW's visualinfo tool

Absence of extension always leads to null function pointer and crash

I will post my code as soon as I'm at home

mbentrup
07-04-2011, 06:40 AM
GLint length;
glGetShaderiv(hProgram,GL_INFO_LOG_LENGTH,&length) ;
What should I do to fixed the problem?

Call glGetProgramiv if hProgram is a program handle.