|
I check for shader errors like this:
int programObject=...;
gl.glValidateProgram(programObject);
int[] error = new int[]{-1};
gl.glGetProgramiv(programObject, GL2GL3.GL_LINK_STATUS, error, 0);
if (error[0] != GL.GL_TRUE) {
int[] len = new int[1];
gl.glGetProgramiv(programObject, GL2ES2.GL_INFO_LOG_LENGTH, len, 0);
if (len[0] == 0) {
return null;
}
byte[] errormessage = new byte[len[0]];
gl.glGetProgramInfoLog(programObject, len[0], len, 0, errormessage, 0);
return new String(errormessage, 0, len[0]);
}
and for the single shaderobjects(fragment, vertex ...)
it is qutie similiar:
int[] error = new int[]{-1};
gl.glGetShaderiv(shader, GL2ES2.GL_COMPILE_STATUS, error, 0);
if (error[0] != GL.GL_TRUE) {
int[] len = new int[1];
gl.glGetShaderiv(shader, GL2ES2.GL_INFO_LOG_LENGTH, len, 0);
if (len[0] == 0) {
return null;
}
byte[] errormessage = new byte[len[0]];
gl.glGetShaderInfoLog(shader, len[0], len, 0, errormessage, 0);
return new String(errormessage, 0, len[0] + 1);
}
|