Example usage for org.lwjgl.opengl GL11 glTexEnvi

List of usage examples for org.lwjgl.opengl GL11 glTexEnvi

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTexEnvi.

Prototype

public static native void glTexEnvi(@NativeType("GLenum") int target, @NativeType("GLenum") int pname,
        @NativeType("GLint") int param);

Source Link

Document

Sets parameters of the texture environment that specifies how texture values are interpreted when texturing a fragment, or sets per-texture-unit filtering parameters.

Usage

From source file:kuake2.render.lwjgl.Image.java

License:Open Source License

void GL_TexEnv(int mode /* GLenum */
) {//from  w w  w .  j  av a2  s  . c  o m

    if (mode != lastmodes[gl_state.currenttmu]) {
        GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, mode);
        lastmodes[gl_state.currenttmu] = mode;
    }
}

From source file:org.free.jake2.render.lwjgl.Image.java

License:Open Source License

void GL_TexEnv(int mode /* GLenum */) {

    if (mode != lastmodes[gl_state.currenttmu]) {
        GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, mode);
        lastmodes[gl_state.currenttmu] = mode;
    }/* ww  w . j a  v  a  2 s .  co m*/
}

From source file:org.jogamp.glg2d.impl.gl2.GL2ImageDrawer.java

License:Apache License

@Override
protected void begin(Texture texture, AffineTransform xform, Color bgcolor) {
    GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
    GL11.glTexParameterf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_BLEND);

    /*/*from  www . ja  v a  2s.  c  o  m*/
     * FIXME This is unexpected since we never disable blending, but in some
     * cases it interacts poorly with multiple split panes, scroll panes and the
     * text renderer to disable blending.
     */
    g2d.setComposite(g2d.getComposite());

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    texture.bind();

    savedTransform = null;
    if (xform != null && !xform.isIdentity()) {
        savedTransform = g2d.getTransform();
        g2d.transform(xform);
    }

    g2d.getColorHelper().setColorRespectComposite(bgcolor == null ? Color.white : bgcolor);
}

From source file:org.spout.engine.resources.ClientTexture.java

License:Open Source License

@Override
public void load() {
    if (textureID != -1) {
        throw new IllegalStateException("Cannot load an already loaded texture!");
    }//from  w w w . j a va 2  s .  c om

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    textureID = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);

    GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);

    /*if (((Client) Spout.getEngine()).getRenderMode() != RenderMode.GL30) {
            
       //Use Mipmaps
       GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
    }*/

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_BASE_LEVEL, 0);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, 0);

    //Bilinear Filter the closest mipmap
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);

    //Wrap the texture
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

    int width = image.getWidth();
    int height = image.getHeight();

    int[] pixels = new int[width * height];
    image.getRGB(0, 0, width, height, pixels, 0, width);

    ByteBuffer buffer = BufferUtils.createByteBuffer(width * height * 4);
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int pixel = pixels[y * width + x];
            buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
            buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
            buffer.put((byte) (pixel & 0xFF)); // Blue component
            buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
        }
    }

    buffer.flip();
    //if (((Client) Spout.getEngine()).getRenderMode() == RenderMode.GL30) {
    //   GL30.glGenerateMipmap(textureID);
    //}

    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL11.GL_RGBA,
            GL11.GL_UNSIGNED_BYTE, buffer);

    //EXTFramebufferObject.glGenerateMipmapEXT(GL11.GL_TEXTURE_2D); //Not sure if this extension is supported on most cards. 
}

From source file:org.voxels.platform.LWJGLOpenGLAdapter.java

License:Open Source License

@Override
public void glTexEnvi(final int target, final int pname, final int param) {
    GL11.glTexEnvi(target, pname, param);
}

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

License:Open Source License

public static void glTexEnvi(int a, int b, int c) {
    GL11.glTexEnvi(a, b, c);
}