Example usage for org.lwjgl.opengl GL20 glUniform2f

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

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

License:Open Source License

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

From source file:org.terasology.rendering.assets.GLSLShaderProgramInstance.java

License:Apache License

/**
 * Sets the shader uniform of the current shader of this shader
 * program to be the given value./*from  www.  j  ava2  s  .c  o  m*/
 * @param desc the uniform name, as used in the shader program itself.
 * @param f1
 * @param f2 
 */
public void setFloat2(String desc, float f1, float f2) {
    int activeShaderProgramId = getActiveShaderProgramId();

    if (activeShaderProgramId <= 0) {
        return;
    }

    enable();
    int id = getUniformLocation(activeShaderProgramId, desc);
    GL20.glUniform2f(id, f1, f2);
}

From source file:org.terasology.rendering.assets.Material.java

License:Apache License

public void setFloat2(String desc, float f1, float f2) {
    if (isDisposed())
        return;/*from  w w  w  .j  a  va 2 s . co m*/

    enable();
    int id = GL20.glGetUniformLocation(shaderProgram, desc);
    if (id != -1) {
        GL20.glUniform2f(id, f1, f2);
    }
}

From source file:org.terasology.rendering.opengl.GLSLMaterial.java

License:Apache License

@Override
public void setFloat2(String desc, float f1, float f2, boolean currentOnly) {
    if (isDisposed()) {
        return;/*from  w  w w . jav  a 2  s.c o m*/
    }
    if (currentOnly) {
        enable();
        int id = getUniformLocation(getActiveShaderProgramId(), desc);
        GL20.glUniform2f(id, f1, f2);
    } else {
        TIntIntIterator it = shaderPrograms.iterator();
        while (it.hasNext()) {
            it.advance();

            GL20.glUseProgram(it.value());
            int id = getUniformLocation(it.value(), desc);
            GL20.glUniform2f(id, f1, f2);
        }

        restoreStateAfterUniformsSet();
    }
}

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glUniform2f(int location, float x, float y) {
    GL20.glUniform2f(location, x, y);
}

From source file:processing.lwjgl.PGL.java

License:Open Source License

public void uniform2f(int loc, float value0, float value1) {
    GL20.glUniform2f(loc, value0, value1);
}

From source file:processing.lwjgl.PLWJGL.java

License:Open Source License

public void uniform2f(int location, float value0, float value1) {
    GL20.glUniform2f(location, value0, value1);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void uniform2f(int location, float value0, float value1) {
    GL20.glUniform2f(location, value0, value1);
}

From source file:renderEngine.ShaderProgram.java

protected void load2DVector(int location, Vector2f vector) {
    GL20.glUniform2f(location, vector.x, vector.y);
}

From source file:se.angergard.engine.graphics.ShaderProgram.java

License:Apache License

/** Sets the uniform with the given name with the given vector2f. You need the {@link #addUniform(String) addUniform} before
 * being able to set the uniform.//from w  w w  .  j a  va  2  s .  c o  m
 *
 * @param uniform The uniform name
 * @param v Vector2f
 * @return This ShaderProgram */
public ShaderProgram setUniformVec2(String uniform, Vector2f v) {
    GL20.glUniform2f(uniforms.get(uniform), v.getX(), v.getY());
    return this;
}