Example usage for org.lwjgl.opengl GL20 nglUniformMatrix4fv

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

Introduction

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

Prototype

public static void nglUniformMatrix4fv(int location, int count, boolean transpose, long value) 

Source Link

Document

Unsafe version of: #glUniformMatrix4fv UniformMatrix4fv

Usage

From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java

License:Apache License

/**
 * {@inheritDoc}//from  www .  j a v  a2  s.com
 */
@Override
public void glUniformMatrix4fv(int name, boolean transpose, Float32Array buffer) {
    GL20.nglUniformMatrix4fv(name, buffer.remaining() >> 6, transpose,
            MemoryUtil.memAddress(buffer.<ByteBuffer>data()));
}

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

License:Open Source License

/**
 * Specifies the value of a uniform variable for this program. Program must
 * be in use. Returns true if and only if the uniform exists and is active.
 * //from www .j  a va  2s  . c  om
 * @param name The name of the uniform to specify.
 * @return Whether or not the uniform exists and is active.
 */
public boolean uniformMat4(String name, Mat4 matrix) {
    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.wrap(matrix);
    GL20.nglUniformMatrix4fv(loc, 1, false, 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.
 * //from w  w  w .  j  av a2 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 uniformMat4v(String name, Mat4... 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.nglUniformMatrix4fv(loc, array.length, false, address);
    MemStack.pop();
    return true;
}

From source file:com.samrj.devil.graphics.MeshSkinner.java

/**
 * Loads the bone matrices to the shader uniform with the given name.
 * //from ww w .j  a v  a 2 s  .c  o m
 * @param shader The shader program to load into.
 * @param arrayName The name of the matrix array variable to set.
 */
public void uniformMats(ShaderProgram shader, String arrayName) {
    int loc = shader.getUniformLocation(arrayName);
    GL20.nglUniformMatrix4fv(loc, bones.size(), false, matBlock.address);
}

From source file:com.samrj.devil.graphics.MeshSkinner.java

public void uniformPrevMats(ShaderProgram shader, String arrayName) {
    if (!prevMatricesEnabled())
        throw new IllegalStateException();

    int loc = shader.getUniformLocation(arrayName);
    GL20.nglUniformMatrix4fv(loc, bones.size(), false, prevMatBlock.address);
}