Example usage for org.lwjgl.opengl GL11 GL_TEXTURE_ENV_MODE

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

Introduction

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

Prototype

int GL_TEXTURE_ENV_MODE

To view the source code for org.lwjgl.opengl GL11 GL_TEXTURE_ENV_MODE.

Click Source Link

Document

TextureEnvParameter

Usage

From source file:fr.def.iss.vd2.lib_v3d.v3draw.V3DrawReader.java

License:Open Source License

private void enableTexture() {
    int textureIndex = buffer.getInt();

    GL11.glEnable(GL11.GL_TEXTURE_2D);//from  w  w w  . j  ava 2s  .  c  o m

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);

    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    //        GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureList.get(textureIndex).getID());
}

From source file:im.bci.jnuit.lwjgl.LwjglHelper.java

License:Open Source License

public static void setupGLTextureParams() {
    if (GLContext.getCapabilities().OpenGL12) {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    } else {/*from w w w . j  a v  a 2s . c  om*/
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
    }
    setupGLTextureQualityParams();
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
}

From source file:im.bci.jnuit.lwjgl.LwjglNuitFont.java

License:Open Source License

public static int loadImage(BufferedImage bufferedImage) {
    short width = (short) bufferedImage.getWidth();
    short height = (short) bufferedImage.getHeight();
    // textureLoader.bpp = bufferedImage.getColorModel().hasAlpha() ?
    // (byte)32 : (byte)24;
    int bpp = (byte) bufferedImage.getColorModel().getPixelSize();
    ByteBuffer byteBuffer;// ww  w.  ja v  a  2 s  .co  m
    DataBuffer db = bufferedImage.getData().getDataBuffer();
    if (db instanceof DataBufferInt) {
        int intI[] = ((DataBufferInt) (bufferedImage.getData().getDataBuffer())).getData();
        byte newI[] = new byte[intI.length * 4];
        for (int i = 0; i < intI.length; i++) {
            byte b[] = intToByteArray(intI[i]);
            int newIndex = i * 4;

            newI[newIndex] = b[1];
            newI[newIndex + 1] = b[2];
            newI[newIndex + 2] = b[3];
            newI[newIndex + 3] = b[0];
        }

        byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder())
                .put(newI);
    } else {
        byteBuffer = ByteBuffer.allocateDirect(width * height * (bpp / 8)).order(ByteOrder.nativeOrder())
                .put(((DataBufferByte) (bufferedImage.getData().getDataBuffer())).getData());
    }
    byteBuffer.flip();

    int internalFormat = GL11.GL_RGBA8, format = GL11.GL_RGBA;
    IntBuffer textureId = BufferUtils.createIntBuffer(1);
    GL11.glGenTextures(textureId);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId.get(0));

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);

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

    GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, internalFormat, width, height, format, GL11.GL_UNSIGNED_BYTE,
            byteBuffer);
    return textureId.get(0);
}

From source file:ion2d.INTexture2D.java

License:Open Source License

/**
 * Creates the actual OpenGL texture to memory
 *//*from w ww.ja va  2s.com*/
protected void createTexture() {
    this.convertToPowerOfTwo();

    if (this.texture != null) {
        IntBuffer tmp = BufferUtils.createIntBuffer(1);
        GL11.glGenTextures(tmp);
        this.id = tmp.get(0);
        this.bind();

        int src = GL11.GL_RGBA;

        if (!this.image.getBufferedImage().getColorModel().hasAlpha()) {
            src = GL11.GL_RGB;
        }

        GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);

        this.setAntiAlias();
        GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);

        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, src, this.width, this.height, 0, src, GL11.GL_UNSIGNED_BYTE,
                this.texture);
    }
}

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

License:Open Source License

void GL_TexEnv(int mode /* GLenum */
) {/* www. ja v  a 2  s.c  om*/

    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.fenggui.binding.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void setTexEnvModeDecal() {
    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_DECAL);
    //GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, GL11.GL_LUMINANCE_ALPHA);
}

From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void setTexEnvModeModulate() {
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
    //GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
}

From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void setupStateVariables(boolean depthTestEnabled) {
    GL11.glEnable(GL11.GL_BLEND);/* w w w  .  j  a v  a2  s.c  o  m*/
    //      GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    if (depthTestEnabled)
        GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_DITHER);

    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    //GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glDisable(GL11.GL_LINE_STIPPLE);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_DECAL);

    //GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_CULL_FACE);
    //      GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glFrontFace(GL11.GL_CW);
    GL11.glCullFace(GL11.GL_BACK);
    // disabling textures after setting state values. They would
    // be ignored otherwise (i think)
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_1D);
}

From source file:org.fenggui.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public void setupStateVariables(boolean depthTestEnabled) {
    GL11.glEnable(GL11.GL_BLEND);//  w w w  . j  a  va2  s .  c  om
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    if (depthTestEnabled)
        GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_DITHER);

    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    //GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glDisable(GL11.GL_LINE_STIPPLE);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_DECAL);

    //GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glFrontFace(GL11.GL_CW);
    GL11.glCullFace(GL11.GL_BACK);
    // disabling textures after setting state values. They would
    // be ignored otherwise (i think)
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_1D);

}

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;
    }//from  w  w w .j  a va  2 s .co m
}