Example usage for org.lwjgl.opengl GL13 GL_ACTIVE_TEXTURE

List of usage examples for org.lwjgl.opengl GL13 GL_ACTIVE_TEXTURE

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL13 GL_ACTIVE_TEXTURE.

Prototype

int GL_ACTIVE_TEXTURE

To view the source code for org.lwjgl.opengl GL13 GL_ACTIVE_TEXTURE.

Click Source Link

Document

Accepted by the pname parameter of GetBooleanv, GetDoublev, GetIntegerv, and GetFloatv.

Usage

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

License:Open Source License

/**
 * Temporarily activates the given texture unit, binds this texture to it,
 * then activates whichever unit was active before this method was called.
 * //from  w  w  w . java  2 s  . c om
 * @param texture The OpenGL texture unit enum to bind to.
 * @return This texture.
 */
public final T bind(int texture) {
    if (deleted)
        throw new IllegalStateException("Cannot bind deleted texture.");
    if (texture < GL13.GL_TEXTURE0)
        throw new IllegalArgumentException();
    int old = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
    GL13.glActiveTexture(texture);
    bind();
    GL13.glActiveTexture(old);
    return getThis();
}

From source file:itdelatrisu.opsu.render.CurveRenderState.java

License:Open Source License

/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve.//from   w  w  w  .j  a v  a2s  .  c om
 */
private RenderState startRender() {
    RenderState state = new RenderState();
    state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
    state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
    state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
    state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
    state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
    state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
    state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
    state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
    GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL14.glBlendEquation(GL14.GL_FUNC_ADD);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_TEXTURE_1D);
    GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

    GL20.glUseProgram(0);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    return state;
}