Example usage for com.badlogic.gdx.graphics.glutils ShaderProgram setUniformi

List of usage examples for com.badlogic.gdx.graphics.glutils ShaderProgram setUniformi

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.glutils ShaderProgram setUniformi.

Prototype

public void setUniformi(int location, int value) 

Source Link

Usage

From source file:com.kotcrab.vis.ui.widget.color.internal.ChannelBar.java

License:Apache License

@Override
protected void setShaderUniforms(ShaderProgram shader) {
    shader.setUniformi("u_mode", mode);
    channelBarListener.setShaderUniforms(shader);
}

From source file:com.lyeeedar.Roguelike3D.Graphics.Materials.TextureAttribute.java

License:Open Source License

@Override
public void bind(ShaderProgram program, LightManager lights) {
    if (texture == null)
        return;//from w w  w . ja v a2  s.  com
    texture.bind(unit);
    program.setUniformi(diffuseTexture, unit);
}

From source file:graphics.terrain.FogOverlay.java

License:Open Source License

protected void applyToTerrain(ShaderProgram shader) {
    updateTex();//from   w  ww.  j a  v  a2  s  .  c  o  m
    oldTex.bind(1);
    newTex.bind(2);
    shader.setUniformi("u_fog_old", 1);
    shader.setUniformi("u_fog_new", 2);
    shader.setUniformf("u_fogSize", sizeX, sizeY);
    shader.setUniformf("u_fogTime", oldTime % 1);
}

From source file:graphics.terrain.FogOverlay.java

License:Open Source License

protected void applyToMinimap(ShaderProgram shader) {
    updateTex();//  ww  w  .  j a va 2 s  .  com
    oldTex.bind(1);
    newTex.bind(2);
    shader.setUniformi("u_fog_old", 1);
    shader.setUniformi("u_fog_new", 2);
    shader.setUniformf("u_fogTime", oldTime % 1);
}

From source file:mobi.shad.s3lib.main.S3Gfx.java

License:Apache License

public static void drawMeshQuad(Texture texture, Texture texture2, ShaderProgram shader) {
    Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE0);
    texture.bind();/*  w ww . j av  a  2  s  .c o  m*/
    Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE1);
    texture2.bind();
    shader.begin();
    shader.setUniformi("u_texture0", 0);
    shader.setUniformi("u_texture1", 1);
    mesh.render(shader, GL20.GL_TRIANGLES);
    shader.end();
}

From source file:mobi.shad.s3lib.main.S3Gfx.java

License:Apache License

public static void drawFlipMeshQuad(Texture texture, Texture texture2, ShaderProgram shader) {
    Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE0);
    texture.bind();//from   w ww .  j a v a  2s  .  c om
    Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE1);
    texture2.bind();
    shader.begin();
    shader.setUniformi("u_texture0", 0);
    shader.setUniformi("u_texture1", 1);
    meshFlip.render(shader, GL20.GL_TRIANGLES);
    shader.end();
}

From source file:seventh.client.gfx.ImageBasedLightSystem.java

License:Open Source License

@Override
public void update(TimeStep timeStep) {
    ShaderProgram shader = this.shader.getShader();
    shader.begin();//from www.  ja  v  a 2 s .  co m
    {
        //            this.ambientColor.set(0.3f, 0.3f, 0.4f);
        //            this.ambientColor.set(0.9f, 0.9f, 0.9f);
        //            this.ambientIntensity = 0.4f;

        shader.setUniformi("u_lightmap", 1);
        shader.setUniformf("ambientColor", ambientColor.x, ambientColor.y, ambientColor.z, ambientIntensity);
        shader.setUniformf("resolution", Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    }
    shader.end();

    for (int i = 0; i < this.lights.size(); i++) {
        Light light = this.lights.get(i);
        light.update(timeStep);
    }

}