public static boolean isShaderStatusValid( final GL _gl, final int shaderObj, final int name, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); final int[] ires = new int[1]; gl.glGetShaderiv(shaderObj, name, ires, 0); final boolean res = ires[0] == 1; if (!res && null != verboseOut) { verboseOut.println("Shader status invalid: " + getShaderInfoLog(gl, shaderObj)); } return res; }
public static String getShaderInfoLog(final GL _gl, final int shaderObj) { final GL2ES2 gl = _gl.getGL2ES2(); final int[] infoLogLength = new int[1]; gl.glGetShaderiv(shaderObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0); if (infoLogLength[0] == 0) { return "(no info log)"; } final int[] charsWritten = new int[1]; final byte[] infoLogBytes = new byte[infoLogLength[0]]; gl.glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); return new String(infoLogBytes, 0, charsWritten[0]); }