winapiopenglcompiler-errorsglsl

glGetShaderiv() GL_COMPILE_STATUS returning GL_FALSE


I tried opening a Visual Studio project on another computer. Im not sure if this is relevant or not but originally I was having issues finding a MSAA pixel format until i changed the WGL_SAMPLES_ARB parameter from 8 to 4.

However the image on the screen is in black and white and wasn't responding to any matrix transformations.

I'm using the GLShaderManager code from the OpenGL SuperBible 5th edition. After it calls glCompileShader(), it calls glGetShaderiv() with the GL_COMPILE_STATUS parameter. I set a break point and sure enough it is returning with GL_FALSE.

This doesn't happen on my other computer. Any idea what could be causing this? This machine uses an ATI Radeon HD 5450, I just updated the drivers.


Solution

  • Alas, GLSL is a slippery beast, and every graphics board, driver, platform and version has a different idea of what constitutes valid code.

    For testing and debugging, you should always add code to check GL_COMPILE_STATUS and GL_LINK_STATUS and bail out, or at least show a warning, if compilation failed.

    Use glGetShaderInfoLog and glGetProgramInfoLog to get output from the shader compiler and linker, respectively. These will probably tell you what is (or what the compiler thinks is) wrong.