Example usage for org.lwjgl.opengl GL20 glUniform1f

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

Introduction

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

Prototype

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

Source Link

Document

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

Usage

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void uniform1f(int location, float value) {
    GL20.glUniform1f(location, value);
}

From source file:renderEngine.ShaderProgram.java

/**
 * Loads a float value to the uniform variable in the specified location.
 *
 * @param location The location of the uniform variable to which the float
 * needs to be loaded.//from w  w w . ja  v a2s  . c  o  m
 * @param value The value that needs to be loaded into the uniform variable.
 */
protected void loadFloat(int location, float value) {
    GL20.glUniform1f(location, value);
}

From source file:renderEngine.ShaderProgram.java

/**
 * Loads a boolean value to the uniform variable in the specified location
 * by converting it to a float first. 1 equals true, 0 equals false;
 *
 * @param location The location of the uniform variable to which the boolean
 * needs to be loaded./*from  www.java  2s.c  om*/
 * @param value The value that needs to be loaded into the uniform variable.
 */
protected void loadBoolean(int location, boolean value) {
    float toLoad = 0;
    if (value) {
        toLoad = 1;
    }
    GL20.glUniform1f(location, toLoad);
}

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

License:Apache License

/** Sets the uniform with the given name with the given float. You need the {@link #addUniform(String) addUniform} before being
 * able to set the uniform./*from ww w  . jav a2 s . c  om*/
 *
 * @param uniform The uniform name
 * @param f Float value
 * @return This ShaderProgram */
public ShaderProgram setUniform1f(String uniform, float f) {
    GL20.glUniform1f(uniforms.get(uniform), f);
    return this;
}

From source file:sketchwars.map.MapWater.java

private void setShaderVariables(float angleOffset) {
    int waveAngleLoc = GL20.glGetUniformLocation(shader.getProgram(), "wave_angle");
    GL20.glUniform1f(waveAngleLoc, waveAngle + angleOffset);

    int waveLengthLoc = GL20.glGetUniformLocation(shader.getProgram(), "wave_length");
    GL20.glUniform1f(waveLengthLoc, WAVE_LENGTH);

    int ampliLoc = GL20.glGetUniformLocation(shader.getProgram(), "amplitude");
    GL20.glUniform1f(ampliLoc, WAVE_AMPLITUDE);

    int yOffsetLoc = GL20.glGetUniformLocation(shader.getProgram(), "y_offset");
    GL20.glUniform1f(yOffsetLoc, Y_OFFSET);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glUniform1f(int a, float b) {
    GL20.glUniform1f(a, b);
}

From source file:wrath.client.graphics.ShaderProgram.java

License:Open Source License

/**
 * Sets the value of a uniform variable in the shader.
 * @param location The integer id of the Uniform variable.
 * @param value The value to set.//  w ww  . j  ava 2  s.c o m
 */
public void setUniformVariable(int location, float value) {
    GL20.glUseProgram(programID);
    GL20.glUniform1f(location, value);
}

From source file:wrath.client.graphics.ShaderProgram.java

License:Open Source License

/**
 * Sets the value of a uniform variable in the shader.
 * @param location The integer id of the Uniform variable.
 * @param value The value to set./*from   w  ww.  j av  a  2s.co  m*/
 */
public void setUniformVariable(int location, boolean value) {
    GL20.glUseProgram(programID);
    GL20.glUniform1f(location, value ? 1f : 0f);
}