Java Code Examples for com.jogamp.opengl.GL2ES2#glGetShaderiv()

The following examples show how to use com.jogamp.opengl.GL2ES2#glGetShaderiv() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DwGLSLShader.java    From PixelFlow with MIT License 6 votes vote down vote up
public static void getShaderInfoLog(GL2ES2 gl, int shader_id, String info) {
  if(shader_id==-1) return;

  IntBuffer log_len = IntBuffer.allocate(1);
  gl.glGetShaderiv(shader_id, GL2ES2.GL_INFO_LOG_LENGTH, log_len);

  ByteBuffer buffer = ByteBuffer.allocate(log_len.get(0));
  gl.glGetShaderInfoLog(shader_id, log_len.get(0), null, buffer);

  String log = Charset.forName("US-ASCII").decode(buffer).toString();

  if( log.length() > 1 && log.charAt(0) != 0){
    System.out.println(info);
    System.out.println(log);
  }
}
 
Example 2
Source File: Compiler.java    From jogl-samples with MIT License 6 votes vote down vote up
public static boolean check(GL2ES2 gl2es2, int shaderName) {

        boolean success = true;

        {
            int[] result = {GL_FALSE};
            gl2es2.glGetShaderiv(shaderName, GL_COMPILE_STATUS, result, 0);

            if (result[0] == GL_FALSE) {
                return false;
            }

            int[] infoLogLength = {0};
            gl2es2.glGetShaderiv(shaderName, GL_INFO_LOG_LENGTH, infoLogLength, 0);
            if (infoLogLength[0] > 0) {
                byte[] infoLog = new byte[infoLogLength[0]];
                gl2es2.glGetShaderInfoLog(shaderName, infoLogLength[0], null, 0, infoLog, 0);
                System.out.println(new String(infoLog));
            }

            success = success && result[0] == GL_TRUE;
        }

        return success;
    }
 
Example 3
Source File: DwGLSLShader.java    From PixelFlow with MIT License 5 votes vote down vote up
public static void getShaderSource(GL2ES2 gl, int shader_id){
  if(shader_id == -1) return;

  IntBuffer log_len = IntBuffer.allocate(1);
  gl.glGetShaderiv(shader_id, GL2ES2.GL_SHADER_SOURCE_LENGTH, log_len);

  ByteBuffer buffer = ByteBuffer.allocate(log_len.get(0));
  gl.glGetShaderSource(shader_id, log_len.get(0), null, buffer);

  String log = Charset.forName("US-ASCII").decode(buffer).toString();

  if(log.length() > 1 && log.charAt(0) != 0){
    System.out.println(log);
  }
}