These are a few common problems that cause people no small amount of consternation. If you have suggestions for things to be added to this list, please send them to me.
#version 420 core in vec2 mcPosition; uniform vec4 scaleTrans; void main() { gl_Position = vec4(0, 0, 0, 1); }
Even if you use them like:
#version 420 core in vec2 mcPosition; uniform vec4 scaleTrans; void main() { float ldsX = scaleTrans[0]*mcPosition.x + scaleTrans[1]; float ldsY = scaleTrans[2]*mcPosition.y + scaleTrans[3]; gl_Position = vec4(0, 0, 0, 1); }the result will be similar because GLSL is so clever that it says "Hey, even though you actually used scaleTrans, it didn't actually affect the program (because the results did not get passed on), so I am not going to allocate storage for it." (The error message for mcPosition does not always appear in this variation.)
Passing any invalid index to any PVA-related routine will log an error. According to the API description, passing any invalid index except -1 to glUniform* will log an error. (There are reasons that the invalid uniform location -1 is "special", but we will not go into that here.) Not all OpenGL implementations log an error when negative locations less than -1 are passed, however, and this is the source of the "common problem". If you are calling glUniform* with negative indices, you may not see any errors, hence you may mistakenly believe that you are setting uniforms when in fact you are not. When debugging problems that are related to values of uniform variables, be sure to check that all such locations have reasonable values. One debugging workaround would be to initialize all uniform location variables to large positive integers so that, if not assigned following program compilation, you will at least see error messages when they are used.
#version 420 core in float somePerVertexVariable; out float somePerVertexVariableToFS; void main() { somePerVertexVariableToFS = somePerVertexVariable; … }Fragment shader:
#version 420 core in int somePerVertexVariableToFS; // uh-oh - should have been "float" void main() { … }The program will compile and run without generating errors, but your variable (somePerVertexVariableToFS) will most likely have an unexpected value.