Example usage for org.lwjgl.opengl GL20 nglUniform3fv

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

Introduction

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

Prototype

public static void nglUniform3fv(int location, int count, long value) 

Source Link

Document

Unsafe version of: #glUniform3fv Uniform3fv

Usage

From source file:com.samrj.devil.gl.ShaderProgram.java

License:Open Source License

/**
 * Specifies the values of a uniform variable array for this program. Must
 * be in use. Returns true if and only if the uniform exists and is active.
 * /* www  .  j  a  v  a  2 s. co m*/
 * @param name The name of the uniform array to specify.
 * @param array An array of values to set the uniform to.
 * @return Whether or not the uniform exists and is active.
 */
public boolean uniform3fv(String name, float... array) {
    if (DGL.currentProgram() != this)
        throw new IllegalStateException("Program must be in use.");
    int loc = GL20.glGetUniformLocation(id, name);
    if (loc < 0)
        return false;

    long address = MemStack.wrapf(array);
    GL20.nglUniform3fv(loc, array.length / 3, address);
    MemStack.pop();
    return true;
}

From source file:com.samrj.devil.gl.ShaderProgram.java

License:Open Source License

/**
 * Specifies the values of a uniform variable array for this program. Must
 * be in use. Returns true if and only if the uniform exists and is active.
 * /*ww w .  java  2  s .c  om*/
 * @param name The name of the uniform array to specify.
 * @param array An array of values to set the uniform to.
 * @return Whether or not the uniform exists and is active.
 */
public boolean uniformVec3v(String name, Vec3... array) {
    if (DGL.currentProgram() != this)
        throw new IllegalStateException("Program must be in use.");
    int loc = GL20.glGetUniformLocation(id, name);
    if (loc < 0)
        return false;

    long address = MemStack.wrapv(array);
    GL20.nglUniform3fv(loc, array.length, address);
    MemStack.pop();
    return true;
}