Example usage for org.lwjgl.opengl GL20 glUniform4f

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

Introduction

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

Prototype

public static void glUniform4f(@NativeType("GLint") int location, @NativeType("GLfloat") float v0,
        @NativeType("GLfloat") float v1, @NativeType("GLfloat") float v2, @NativeType("GLfloat") float v3) 

Source Link

Document

Specifies the value of a vec4 uniform variable for the current program object.

Usage

From source file:lessur.util.shader.ShaderManager.java

License:GNU General Public License

/**
 * //from w  w  w. ja va  2s .  com
 * @param program ID/index of the program
 * @param name Name of the variable
 * @param value Value to set the variable
 */
public void setUniformFloatArray(int program, String name, float values[]) {
    if (has_opengl2) {
        int loc = GL20.glGetUniformLocation(program, name);
        checkVariableLocation(loc, name);
        if (values.length == 1)
            GL20.glUniform1f(loc, values[0]);
        if (values.length == 2)
            GL20.glUniform2f(loc, values[0], values[1]);
        else if (values.length == 3)
            GL20.glUniform3f(loc, values[0], values[1], values[2]);
        else if (values.length == 4)
            GL20.glUniform4f(loc, values[0], values[1], values[2], values[3]);
    } else if (has_arb) {
        int loc = ARBShaderObjects.glGetUniformLocationARB(program, name);
        checkVariableLocation(loc, name);
        if (values.length == 1)
            ARBShaderObjects.glUniform1fARB(loc, values[0]);
        if (values.length == 2)
            ARBShaderObjects.glUniform2fARB(loc, values[0], values[1]);
        else if (values.length == 3)
            ARBShaderObjects.glUniform3fARB(loc, values[0], values[1], values[2]);
        else if (values.length == 4)
            ARBShaderObjects.glUniform4fARB(loc, values[0], values[1], values[2], values[3]);
    }
}

From source file:me.thehutch.fusion.engine.render.opengl.gl20.OpenGL20Program.java

License:Open Source License

@Override
public void setUniform(String name, Vector4 vec) {
    final int loc = uniforms.get(name);
    if (loc >= 0) {
        GL20.glUniform4f(loc, vec.getX(), vec.getY(), vec.getZ(), vec.getW());
    }/* w ww. ja v a  2 s .  com*/
}

From source file:net.betabears.the2dlibrary.graphics.shader.Uniform4f.java

@Override
public void apply(int location) {
    GL20.glUniform4f(location, f0, f1, f2, f3);
}

From source file:net.neilcsmith.praxis.video.opengl.internal.ShaderProgram.java

License:Apache License

/** Sets the uniform with the given name. Throws an IllegalArgumentException in case it is not called in between a
 * {@link #begin()}/{@link #end()} block.
 * /* www  . jav  a 2 s .c o  m*/
 * @param name the name of the uniform
 * @param value1 the first value
 * @param value2 the second value
 * @param value3 the third value
 * @param value4 the fourth value */
public void setUniformf(String name, float value1, float value2, float value3, float value4) {
    checkContext();
    int location = fetchUniformLocation(name);
    GL20.glUniform4f(location, value1, value2, value3, value4);
}

From source file:net.smert.frameworkgl.opengl.helpers.ShaderUniformHelper.java

License:Apache License

public void setUniform(int uniformID, float value1, float value2, float value3, float value4) {
    GL20.glUniform4f(uniformID, value1, value2, value3, value4);
}

From source file:net.smert.frameworkgl.opengl.helpers.ShaderUniformHelper.java

License:Apache License

public void setUniform(int uniformID, int value1, int value2, int value3, int value4) {
    GL20.glUniform4f(uniformID, value1, value2, value3, value4);
}

From source file:org.oscim.gdx.LwjglGL20.java

License:Apache License

public void uniform4f(int location, float x, float y, float z, float w) {
    GL20.glUniform4f(location, x, y, z, w);
}

From source file:org.spout.engine.renderer.shader.variables.ColorShaderVariable.java

License:Open Source License

@Override
public void assign() {
    GL20.glUniform4f(this.location, value.getRed() / 255.0f, value.getGreen() / 255.0f,
            value.getBlue() / 255.0f, value.getAlpha() / 255.0f);
}

From source file:org.spout.engine.renderer.shader.variables.Vec4ShaderVariable.java

License:Open Source License

@Override
public void assign() {
    GL20.glUniform4f(location, value.getX(), value.getY(), value.getZ(), value.getW());
}

From source file:org.spout.renderer.lwjgl.gl20.GL20Program.java

License:Open Source License

@Override
public void setUniform(String name, Vector4f v) {
    checkCreated();//from  ww  w.j a va2  s .co  m
    if (!uniforms.containsKey(name)) {
        return;
    }
    GL20.glUniform4f(uniforms.get(name), v.getX(), v.getY(), v.getZ(), v.getW());
    LWJGLUtil.checkForGLError();
}