Re: problems with shaders
Posted by
gouessej on
Jan 24, 2011; 11:32am
URL: https://forum.jogamp.org/problems-with-shaders-tp2092883p2319023.html
No you're wrong, I rather do this:
final GL2 gl = GLU.getCurrentGL().getGL2();
gl.glGetShaderiv(id, GL2ES2.GL_COMPILE_STATUS, intBuffer);
if (intBuffer.get(0) == GL.GL_FALSE) {
gl.glGetShaderiv(id, GL2ES2.GL_INFO_LOG_LENGTH, intBuffer);
final int length = intBuffer.get(0);
String out = null;
if (length > 0) {
final ByteBuffer infoLog = Buffers.newDirectByteBuffer(length);
gl.glGetShaderInfoLog(id, infoLog.limit(), intBuffer, infoLog);
final byte[] infoBytes = new byte[length];
infoLog.get(infoBytes);
out = new String(infoBytes);
}
throw new GLException("Error during shader compilation: " + out);
}
You compile a shader, not a program. Therefore, you have to use methods related on shaders (glGetShaderiv, ...) instead of using methods related on programs. If you want to get errors about the link, then use methods related on programs (glGetProgramiv, ...).