Example usage for org.lwjgl.opengl GL20 glGetActiveUniform

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

Introduction

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

Prototype

@NativeType("void")
public static String glGetActiveUniform(@NativeType("GLuint") int program, @NativeType("GLuint") int index,
        @NativeType("GLsizei") int maxLength, @NativeType("GLint *") IntBuffer size,
        @NativeType("GLenum *") IntBuffer type) 

Source Link

Document

Returns information about an active uniform variable for the specified program object.

Usage

From source file:com.badlogic.gdx.backends.lwjgl3.Lwjgl3GL20.java

License:Apache License

public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type) {
    IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
    String name = GL20.glGetActiveUniform(program, index, 256, size, typeTmp);
    size.put(typeTmp.get(0));//from   w  w  w.  j  a v  a 2s .  co m
    if (type instanceof IntBuffer)
        ((IntBuffer) type).put(typeTmp.get(1));
    return name;
}

From source file:com.google.gapid.glviewer.gl.Shader.java

License:Apache License

private static Uniform[] getActiveUniforms(int program) {
    int maxUniformNameLength = GL20.glGetProgrami(program, GL20.GL_ACTIVE_UNIFORM_MAX_LENGTH);
    int numUniforms = GL20.glGetProgrami(program, GL20.GL_ACTIVE_UNIFORMS);
    IntBuffer size = createIntBuffer(1), type = createIntBuffer(1);

    Uniform[] result = new Uniform[numUniforms];
    for (int i = 0; i < numUniforms; i++) {
        String name = GL20.glGetActiveUniform(program, i, maxUniformNameLength, size, type);
        if (name.endsWith("[0]")) {
            name = name.substring(0, name.length() - 3);
        }/*from   w  ww.  j  a v  a  2s  .  com*/
        result[i] = new Uniform(GL20.glGetUniformLocation(program, name), name, type.get(0));
    }
    return result;
}

From source file:com.google.gapid.glviewer.gl.Util.java

License:Apache License

public static AttributeOrUniform[] getActiveUniforms(int program) {
    int maxUniformNameLength = getProgramiv(program, GL20.GL_ACTIVE_UNIFORM_MAX_LENGTH);
    int numUniforms = getProgramiv(program, GL20.GL_ACTIVE_UNIFORMS);
    IntBuffer size = createIntBuffer(1), type = createIntBuffer(1);

    AttributeOrUniform[] result = new AttributeOrUniform[numUniforms];
    for (int i = 0; i < numUniforms; i++) {
        String name = GL20.glGetActiveUniform(program, i, maxUniformNameLength, size, type);
        if (name.endsWith("[0]")) {
            name = name.substring(0, name.length() - 3);
        }//from w w w .j  a v  a  2  s .com
        result[i] = new AttributeOrUniform(GL20.glGetUniformLocation(program, name), name, type.get(0),
                size.get(0));
    }
    return result;
}