Example usage for org.lwjgl.opengl GL20 GL_FLOAT_VEC2

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

Introduction

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

Prototype

int GL_FLOAT_VEC2

To view the source code for org.lwjgl.opengl GL20 GL_FLOAT_VEC2.

Click Source Link

Document

Returned by the type parameter of GetActiveUniform.

Usage

From source file:com.samrj.devil.gl.AttributeType.java

public static final AttributeType get(int glEnum) {
    switch (glEnum) {
    case GL11.GL_FLOAT:
        return AttributeType.FLOAT;
    case GL20.GL_FLOAT_VEC2:
        return AttributeType.VEC2;
    case GL20.GL_FLOAT_VEC3:
        return AttributeType.VEC3;
    case GL20.GL_FLOAT_VEC4:
        return AttributeType.VEC4;
    case GL20.GL_FLOAT_MAT2:
        return AttributeType.MAT2;
    case GL20.GL_FLOAT_MAT3:
        return AttributeType.MAT3;
    case GL20.GL_FLOAT_MAT4:
        return AttributeType.MAT4;
    case GL11.GL_INT:
        return AttributeType.INT;
    case GL20.GL_INT_VEC2:
        return AttributeType.VEC2I;
    case GL20.GL_INT_VEC3:
        return AttributeType.VEC3I;
    case GL20.GL_INT_VEC4:
        return AttributeType.VEC4I;
    default:/*  w  ww . j av a  2  s . c o  m*/
        return null;
    }
}

From source file:fr.ign.cogit.geoxygene.appli.gl.Shader.java

License:Open Source License

private int resolveType(String utype) {
    switch (utype.toLowerCase()) {
    case "float":
        return GL11.GL_FLOAT;
    case "int":
        return GL11.GL_INT;
    case "sampler2d":
        return GL20.GL_SAMPLER_2D;
    case "vec2":
        return GL20.GL_FLOAT_VEC2;
    default:/*from w  ww  . j av a2  s .  c o m*/
        Logger.getRootLogger().error("Error while parsing the uniforms in the shader " + this.getName()
                + " : uniform type " + utype + " is unknown");
        return 0;
    }
}

From source file:fr.ign.cogit.geoxygene.util.gl.GLProgram.java

License:Open Source License

public void setUniform(String name, Object value) throws GLException {
    logger.debug("Setting " + name + " to " + value);
    if (this.uniforms.get(name) == null) {
        logger.error(" Unknown uniform named " + name + "(GLProgram " + this.name + ")");
        return;/*from   ww  w .  java 2s .  c om*/
    }
    switch (this.uniforms.get(name).getGlType()) {
    case GL11.GL_FLOAT:
        //Value must be a Number
        Number nval = (Number) value;
        this.setUniform1f(name, nval.floatValue());
        break;
    case GL11.GL_INT:
        nval = (Number) value;
        this.setUniform1i(name, nval.intValue());
        break;
    case GL11.GL_UNSIGNED_INT:
        nval = (Number) value;
        this.setUniform1i(name, nval.intValue());
        break;
    case GL20.GL_FLOAT_VEC2:
        Number[] ftab = (Number[]) value;
        this.setUniform2f(name, ftab[0].floatValue(), ftab[1].floatValue());
        break;
    case GL20.GL_FLOAT_VEC4:
        ftab = (Number[]) value;
        this.setUniform4f(name, ftab[0].floatValue(), ftab[1].floatValue(), ftab[2].floatValue(),
                ftab[3].floatValue());
        break;
    case GL20.GL_SAMPLER_2D:
        nval = (Number) value;
        //The value must be the Texture slot number.
        this.setUniform1i(name, nval.intValue());
        break;
    default:
        logger.error(this.uniforms.get(name).getGlType() + " uniform type is not yet implemented!");
        break;
    }
}