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:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java

License:Apache License

/**
 * {@inheritDoc}/*from   w  ww .  j a v a  2s.c o m*/
 */
@Override
public void glUniform2f(int name, float i1, float i2) {
    GL20.glUniform2f(name, i1, i2);
}

From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java

License:Apache License

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

From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Program.java

License:MIT License

@Override
public void setUniform(String name, Vector2f v) {
    checkCreated();//  w w  w.  j  av  a2  s  .co m
    if (!isDirty(name, v)) {
        return;
    }
    GL20.glUniform2f(uniforms.get(name), v.getX(), v.getY());
    uniformValues.put(name, v);
    LWJGLUtil.checkForGLError();
}

From source file:com.grillecube.client.opengl.GLProgram.java

protected void loadUniformVec(int location, float x, float y) {
    GL20.glUniform2f(location, x, y);
}

From source file:com.grillecube.engine.opengl.object.GLProgram.java

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

From source file:com.redthirddivision.quad.rendering.shaders.Shader.java

License:Apache License

public void setUniform(int location, Vector2f value) {
    GL20.glUniform2f(location, value.x, value.y);
}

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   w  w w.j av  a2 s  . c  o m
 * @param name The name of the uniform to specify.
 * @return Whether or not the uniform exists and is active.
 */
public boolean uniform2f(String name, float x, float y) {
    if (DGL.currentProgram() != this)
        throw new IllegalStateException("Program must be in use.");
    int loc = GL20.glGetUniformLocation(id, name);
    if (loc < 0)
        return false;
    GL20.glUniform2f(loc, x, y);
    return true;
}

From source file:com.sgflt.ShaderManager.ShaderManager.java

License:Apache License

/**
 * Pass an LWJGL Vector2f to the active shader. The shader to which the value will be passed must be bound.
 * //from w w  w.  j ava 2 s. c om
 * @param varName Name of the variable that is in the shader program. Must be an exact match.
 * @param v LWJGL Vector2f.
 */
public void putVector2f(String varName, Vector2f v) throws NullPointerException {
    if (v == null) {
        throw new NullPointerException("Vector2f passed is null.");
    }
    if (activeShader != null) {
        int location = GL20.glGetUniformLocation(activeShader.shaderProgram, varName);
        GL20.glUniform2f(location, v.x, v.y);
    }
}

From source file:com.xrbpowered.gl.examples.GLFractal.java

License:Open Source License

@Override
protected void setupResources() {
    super.setupResources();
    palette = new Texture("palette.png");
    shader = new PostProcessShader("post_fractal_f.glsl") {
        private int aspectLocation;
        private int pivotLocation;
        private int zoomLocation;
        private int maxiLocation;

        @Override/*from  ww  w . ja v a 2  s .com*/
        protected void storeUniformLocations() {
            super.storeUniformLocations();
            aspectLocation = GL20.glGetUniformLocation(pId, "aspect");
            pivotLocation = GL20.glGetUniformLocation(pId, "pivot");
            zoomLocation = GL20.glGetUniformLocation(pId, "zoom");
            maxiLocation = GL20.glGetUniformLocation(pId, "maxi");
            GL20.glUseProgram(pId);
            GL20.glUniform1i(GL20.glGetUniformLocation(pId, "palette"), 0);
            GL20.glUseProgram(0);
        }

        @Override
        public void updateUniforms() {
            super.updateUniforms();
            GL20.glUniform1f(aspectLocation, (float) Display.getWidth() / (float) Display.getHeight());
            GL20.glUniform2f(pivotLocation, pivotx, pivoty);
            GL20.glUniform1f(zoomLocation, zoom);
            GL20.glUniform1i(maxiLocation, maxi);
        }
    };
    uiDebugPane.setVisible(false);
    resetBuffer();
}

From source file:com.xrbpowered.gl.examples.GLPerlin.java

License:Open Source License

@Override
protected void setupResources() {
    super.setupResources();
    shader = new PostProcessShader("post_noise_f.glsl") {
        private int pivotLocation;
        private int scaleLocation;
        private int seedLocation;

        @Override//from   w  ww .  j a va  2s . c  o m
        protected void storeUniformLocations() {
            super.storeUniformLocations();
            pivotLocation = GL20.glGetUniformLocation(pId, "pivot");
            scaleLocation = GL20.glGetUniformLocation(pId, "scale");
            seedLocation = GL20.glGetUniformLocation(pId, "seed");
            GL20.glUseProgram(pId);
            GL20.glUniform1i(GL20.glGetUniformLocation(pId, "palette"), 0);
            GL20.glUseProgram(0);
        }

        @Override
        public void updateUniforms() {
            super.updateUniforms();
            GL20.glUniform2f(pivotLocation, pivotx, pivoty);
            GL20.glUniform2f(scaleLocation, buffer.getWidth() / 2, buffer.getHeight() / 2);
            GL20.glUniform1i(seedLocation, seed);
        }
    };
    resetBuffer();
}