Example usage for org.lwjgl.opengl GL20 glGetShaderi

List of usage examples for org.lwjgl.opengl GL20 glGetShaderi

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL20 glGetShaderi.

Prototype

@NativeType("void")
public static int glGetShaderi(@NativeType("GLuint") int shader, @NativeType("GLenum") int pname) 

Source Link

Document

Returns a parameter from a shader object.

Usage

From source file:opengl.test.object.tree.testobject.trunk.java

private void vertexShader(String file) {
    this.vertexID = GL20.glCreateShader(GL20.GL_VERTEX_SHADER);
    GL20.glShaderSource(this.vertexID, trunk.sourceLoader(file));
    GL20.glCompileShader(this.vertexID);
    if (GL20.glGetShaderi(this.vertexID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) {
        throw new RuntimeException("Khong the compile vertexShader");
    }/*from w w  w  . j  a  va2  s .  c  o  m*/
    GL20.glAttachShader(this.programID, this.vertexID);
}

From source file:opengl.test.object.tree.testobject.trunk.java

private void fragmentShader(String file) {
    this.fragmentID = GL20.glCreateShader(GL20.GL_FRAGMENT_SHADER);
    GL20.glShaderSource(this.fragmentID, trunk.sourceLoader(file));
    GL20.glCompileShader(this.fragmentID);
    if (GL20.glGetShaderi(this.fragmentID, GL20.GL_COMPILE_STATUS) != GL11.GL_TRUE) {
        throw new RuntimeException("Khong the compile fragmentShader");
    }/*www  .  j a  v  a2  s.  c  o m*/
    GL20.glAttachShader(this.programID, this.fragmentID);

}

From source file:org.jogamp.glg2d.impl.shader.AbstractShaderPipeline.java

License:Apache License

protected void checkShaderThrowException(int shaderId) {
    int result = GL20.glGetShaderi(shaderId, GL20.GL_COMPILE_STATUS);
    if (result == GL11.GL_TRUE) {
        return;// w  w  w. ja  va  2s. co  m
    }

    int loglen = GL20.glGetShaderi(shaderId, GL20.GL_INFO_LOG_LENGTH);
    String error = GL20.glGetShaderInfoLog(shaderId, loglen);

    throw new ShaderException(error);
}

From source file:org.jogamp.glg2d.impl.shader.AbstractShaderPipeline.java

License:Apache License

protected void checkProgramThrowException(int programId, int statusFlag) {
    int result = GL20.glGetProgrami(programId, statusFlag);
    if (result == GL11.GL_TRUE) {
        return;/* ww  w  . j  a v  a2  s .  c om*/
    }

    int loglen = GL20.glGetShaderi(programId, GL20.GL_INFO_LOG_LENGTH);
    String error = GL20.glGetShaderInfoLog(programId, loglen);
    throw new ShaderException(error);
}

From source file:ovh.tgrhavoc.gameengine.core.Shader.java

License:Open Source License

private void addProgram(String text, int type) {
    int shader = GL20.glCreateShader(type);
    if (shader == 0) {
        System.err.println("Could not find valid memory location when adding shader");
        System.exit(-1);//from w  w w.j ava 2 s. c om
    }

    GL20.glShaderSource(shader, text);
    GL20.glCompileShader(shader);

    if (GL20.glGetShaderi(shader, GL20.GL_COMPILE_STATUS) == 0) {
        System.err.println(GL20.glGetShaderInfoLog(shader, 1024));
        System.exit(-1);
    }

    GL20.glAttachShader(pointer, shader);
}

From source file:processing.lwjgl.PGL.java

License:Open Source License

public String getShaderInfoLog(int shader) {
    int len = GL20.glGetShaderi(shader, GL20.GL_INFO_LOG_LENGTH);
    return GL20.glGetShaderInfoLog(shader, len);
}

From source file:processing.lwjgl.PLWJGL.java

License:Open Source License

public String getShaderSource(int shader) {
    int len = GL20.glGetShaderi(shader, GL20.GL_SHADER_SOURCE_LENGTH);
    return GL20.glGetShaderSource(shader, len);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public String getShaderInfoLog(int shader) {
    int len = GL20.glGetShaderi(shader, GL20.GL_INFO_LOG_LENGTH);
    return GL20.glGetShaderInfoLog(shader, len);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public String getShaderSource(int shader) {
    int len = GL20.glGetShaderi(shader, GL20.GL_SHADER_SOURCE_LENGTH);
    return GL20.glGetShaderSource(shader, len);
}

From source file:renderEngine.ShaderProgram.java

/**
 * Loads the shader given its content and type.
 *
 * @param file The content of the shader file.
 * @param type The type of shader (lwjgl!).
 * @return The shader ID.//from w w  w . j  a v  a 2  s. c  o m
 */
private static int loadShader(String file, int type) {
    StringBuilder shaderSource = new StringBuilder();

    try {
        BufferedReader reader = new BufferedReader(new FileReader(file));
        String line;
        while ((line = reader.readLine()) != null) {
            shaderSource.append(line).append("\n");
        }
        reader.close();
    } catch (IOException ex) {
        Logger.getLogger(ShaderProgram.class.getName()).log(Level.SEVERE, null, ex);
    }
    int shaderID = GL20.glCreateShader(type);
    GL20.glShaderSource(shaderID, shaderSource);
    GL20.glCompileShader(shaderID);
    if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
        System.out.println(GL20.GL_COMPILE_STATUS);
        System.out.println("Shader of type: " + type + " did not compile!");
    }
    return shaderID;

}