source = value;
}
public void compile() {
if (isDisposed()) {
throw new GLException();
}
if (source == null || source.isEmpty()) {
throw new GLException();
}
glInvoke("glCompileShader",
int.class, getId()
);
int[] status = new int[1];
glInvoke("glGetShaderiv",
int.class, getId(),
int.class, GL3.GL_COMPILE_STATUS,
int[].class, status,
int.class, 0
);
if (status[0] == GL.GL_TRUE) {
return;
}
int[] length = new int[1];
glInvoke("glGetShaderiv",
int.class, getId(),
int.class, GL3.GL_INFO_LOG_LENGTH,
int[].class, length,
int.class, 0
);
byte[] chars = new byte[length[0]];
glInvoke("glGetShaderInfoLog",
int.class, getId(),
int.class, length[0],
int[].class, length,
int.class, 0,
char[].class, chars,
int.class, 0
);
String message = new String(chars, Charset.forName("utf-8"));
throw new GLException(message);
}