Example usage for org.lwjgl.opengl GL11 glBlendFunc

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

Introduction

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

Prototype

public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor) 

Source Link

Document

Specifies the weighting factors used by the blend equation, for both RGB and alpha functions and for all draw buffers.

Usage

From source file:de.mineformers.gui.api.util.RenderHelper.java

License:LGPL

public static void drawRectangle(Color color, int x, int y, int width, int height, int zLevel) {
    float colorMod = 1F / 255F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from w ww.  jav a  2 s .c  om
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(colorMod * color.getRed(), colorMod * color.getGreen(), colorMod * color.getBlue(),
            colorMod * color.getAlpha());
    drawRectangle(x, y, 0, 0, width, height, zLevel);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:de.mineformers.powergrid.client.renderer.tileentity.TileCableRenderer.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTick) {
    TileCable tile = (TileCable) tileentity;
    Tessellator tess = Tessellator.instance;

    this.bindTexture(TextureMap.locationBlocksTexture);
    EnumSet<ForgeDirection> cons = tile.getConnections();

    this.bindBlock();

    GL11.glPushMatrix();/*from w ww  .  ja v a  2s.c  om*/
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTranslated(x, y, z);

    drawBase(tess, cons);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    if (cons.contains(ForgeDirection.UP)) {
        drawConnection(tess);
    }
    if (cons.contains(ForgeDirection.DOWN)) {
        GL11.glRotatef(180, 1, 0, 0);
        drawConnection(tess);
        GL11.glRotatef(-180, 1, 0, 0);
    }
    if (cons.contains(ForgeDirection.EAST)) {
        GL11.glRotatef(-90, 0, 0, 1);
        drawConnection(tess);
        GL11.glRotatef(90, 0, 0, 1);
    }
    if (cons.contains(ForgeDirection.WEST)) {
        GL11.glRotatef(90, 0, 0, 1);
        drawConnection(tess);
        GL11.glRotatef(-90, 0, 0, 1);
    }

    if (cons.contains(ForgeDirection.NORTH)) {
        GL11.glRotatef(-90, 1, 0, 0);
        drawConnection(tess);
        GL11.glRotatef(90, 1, 0, 0);
    }
    if (cons.contains(ForgeDirection.SOUTH)) {
        GL11.glRotatef(90, 1, 0, 0);
        drawConnection(tess);
        GL11.glRotatef(-90, 1, 0, 0);
    }

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:de.mineformers.robots.client.gui.util.render.ModelDrawingHelper.java

License:LGPL

public void render(int par0, int par1, int par2) {
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glPushMatrix();/*  w w  w .  j  a va  2 s.c om*/
    GL11.glTranslatef((float) par0, (float) par1, 50.0F);
    GL11.glScalef((float) (-par2), (float) par2, (float) par2);
    GL11.glRotatef(180F, 0, 1, 0);
    /*current = System.currentTimeMillis();
    if(current - last >= 0) {
    last = current;
    rotation += 0.1F;
    }*/
    rotation += 0.3F;
    GL11.glRotatef(rotation, 0, 1, 0);

    RenderHelper.bindTexture(texture);
    model.justRender(false);
    if (tile.getStackInSlot(0) != null) {
        Tessellator tessellator = Tessellator.instance;
        GL11.glPushMatrix();

        GL11.glTranslatef(0, 0.35F, -0.1F);
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glScalef(0.5F, 0.5F, 1F);
        Icon icon = ModItems.module.getIcon(tile.getStackInSlot(0), 0);
        float f4 = icon.getMinU();
        float f5 = icon.getMaxU();
        float f6 = icon.getMinV();
        float f7 = icon.getMaxV();
        float f9 = 0.5F;
        float f10 = 0.25F;
        float f12 = 0.0625F;
        float f11 = 0.021875F;
        ItemStack itemstack = tile.getStackInSlot(0);
        int j = itemstack.stackSize;
        byte b0 = customRenderItem.getMiniItemCount(itemstack);

        GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));

        for (int k = 0; k < b0; ++k) {
            // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
            GL11.glTranslatef(0f, 0f, f12 + f11);

            if (itemstack.getItemSpriteNumber() == 0) {
                RenderHelper.bindTexture(TextureMap.locationBlocksTexture);
            } else {
                RenderHelper.bindTexture(TextureMap.locationItemsTexture);
            }

            GL11.glColor4f(1, 1, 1, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getIconWidth(), icon.getIconHeight(),
                    f12);

            if (itemstack.hasEffect(0)) {
                GL11.glDepthFunc(GL11.GL_EQUAL);
                GL11.glDisable(GL11.GL_LIGHTING);
                RenderManager.instance.renderEngine.bindTexture(RES_ITEM_GLINT);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
                float f13 = 0.76F;
                GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
                GL11.glMatrixMode(GL11.GL_TEXTURE);
                GL11.glPushMatrix();
                float f14 = 0.125F;
                GL11.glScalef(f14, f14, f14);
                float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
                GL11.glTranslatef(f15, 0.0F, 0.0F);
                GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
                ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
                GL11.glPopMatrix();
                GL11.glPushMatrix();
                GL11.glScalef(f14, f14, f14);
                f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
                GL11.glTranslatef(-f15, 0.0F, 0.0F);
                GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
                ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
                GL11.glPopMatrix();
                GL11.glMatrixMode(GL11.GL_MODELVIEW);
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_LIGHTING);
                GL11.glDepthFunc(GL11.GL_LEQUAL);
            }
        }

        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
}

From source file:de.mineformers.robots.client.gui.util.RenderHelper.java

License:LGPL

public static void drawRectangleStretched(ResourceLocation texture, int x, int y, float u, float v, int width,
        int height, float uMax, float vMax, boolean max, int zLevel) {
    if (max) {//  w w w . j  a  va2 s.co  m
        RenderHelper.bindTexture(texture);
        float f = 0.00390625F;
        float f1 = 0.00390625F;
        if ((u > 0 && u % 1 != 0) || uMax == 1 || uMax % 1 != 0)
            f = 1;
        if ((v > 0 && v % 1 != 0) || vMax == 1 || vMax % 1 != 0)
            f1 = 1;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV((double) (x), (double) (y + height), (double) zLevel, (double) u * f,
                (double) vMax * f1);
        tessellator.addVertexWithUV((double) (x + width), (double) (y + height), (double) zLevel,
                (double) uMax * f, (double) vMax * f1);
        tessellator.addVertexWithUV((double) (x + width), (double) (y), (double) zLevel, (double) uMax * f,
                (double) v * f1);
        tessellator.addVertexWithUV((double) (x), (double) (y), (double) zLevel, (double) (u) * f,
                (double) (v) * f1);
        tessellator.draw();
        GL11.glDisable(GL11.GL_BLEND);
    } else {
        drawRectangleStretched(texture, x, y, u, v, width, height, uMax, vMax, zLevel);
    }
}

From source file:de.mineformers.robots.client.renderer.entity.RenderRobot.java

License:LGPL

@Override
protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4,
        float par5, float par6, float par7) {
    super.renderModel(par1EntityLivingBase, par2, par3, par4, par5, par6, par7);
    EntityRobot robot = ((EntityRobot) par1EntityLivingBase);
    RenderHelper.bindTexture(robot.getChipset().getHeadTexture());
    ((ModelRobot) mainModel).renderEye(false);
    Tessellator tessellator = Tessellator.instance;
    GL11.glPushMatrix();/*from   w ww.  ja  v  a 2 s  . c  o m*/

    GL11.glTranslatef(0, 0.35F, -0.1F);
    GL11.glRotatef(180, 1, 0, 0);
    GL11.glScalef(0.5F, 0.5F, 1F);
    ItemStack itemstack = PrivateRobotHelper.createModuleStack(robot.getModule());
    Icon icon = ModItems.module.getIcon(itemstack, 0);
    float f4 = icon.getMinU();
    float f5 = icon.getMaxU();
    float f6 = icon.getMinV();
    float f7 = icon.getMaxV();
    float f9 = 0.5F;
    float f10 = 0.25F;
    float f12 = 0.0625F;
    float f11 = 0.021875F;

    int j = itemstack.stackSize;
    byte b0 = customRenderItem.getMiniItemCount(itemstack);

    GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));

    for (int k = 0; k < b0; ++k) {
        // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
        GL11.glTranslatef(0f, 0f, f12 + f11);

        if (itemstack.getItemSpriteNumber() == 0) {
            RenderHelper.bindTexture(TextureMap.locationBlocksTexture);
        } else {
            RenderHelper.bindTexture(TextureMap.locationItemsTexture);
        }

        GL11.glColor4f(1, 1, 1, 1.0F);
        GL11.glRotatef(180, 0, 1, 0);
        GL11.glTranslatef(-1, 0, 0.05F);
        ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getIconWidth(), icon.getIconHeight(),
                f12);

        if (itemstack.hasEffect(0)) {
            GL11.glDepthFunc(GL11.GL_EQUAL);
            GL11.glDisable(GL11.GL_LIGHTING);
            RenderManager.instance.renderEngine.bindTexture(RES_ITEM_GLINT);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
            float f13 = 0.76F;
            GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glPushMatrix();
            float f14 = 0.125F;
            GL11.glScalef(f14, f14, f14);
            float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
            GL11.glTranslatef(f15, 0.0F, 0.0F);
            GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            GL11.glScalef(f14, f14, f14);
            f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
            GL11.glTranslatef(-f15, 0.0F, 0.0F);
            GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
            GL11.glPopMatrix();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDepthFunc(GL11.GL_LEQUAL);
        }
    }

    GL11.glPopMatrix();
}

From source file:de.mineformers.robots.client.renderer.tileentity.TileFactoryControllerRenderer.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTicks) {
    if (((TileFactoryController) tileentity).isValidMultiblock()) {
        GL11.glPushMatrix();/*  ww w  .ja v a 2  s .  co  m*/
        int i = 15728880;

        int j = i % 65536;
        int k = i / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
        GL11.glTranslated(x + 0.5F, y + 0.65F, z + 0.5f);
        switch (((TileFactoryController) tileentity).getOrientation()) {
        case WEST:
            GL11.glRotatef(90, 0, 1, 0);
            break;
        case EAST:
            GL11.glRotatef(-90, 0, 1, 0);
            break;
        case SOUTH:
            GL11.glRotatef(180, 0, 1, 0);
            break;
        }
        GL11.glTranslatef(0, 0, -0.47F);
        GL11.glScalef(0.3F, 0.3F, 0.3F);
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glRotatef(180, 0, 1, 0);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glColor4f(255F, 255F, 255F, 255F);
        this.bindTexture(robotTexture);
        robot.justRender();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
}

From source file:de.sanandrew.core.manpack.mod.client.UpdateOverlayManager.java

License:Creative Commons License

public void renderInfobox() {
    if (this.mc == null || this.fontRenderer == null) {
        this.mc = Minecraft.getMinecraft();
        this.fontRenderer = new FontRenderer(this.mc.gameSettings,
                new ResourceLocation("textures/font/ascii.png"), this.mc.renderEngine, true);
        this.timer.elapsedTicks = -1;
    }//ww w. j  a  v a  2 s  .c  om

    if (this.counter == 0 && this.scale <= 0.00F) {
        return;
    }

    this.fontRenderer.setBidiFlag(this.mc.fontRenderer.getBidiFlag());
    String update = this.updateMods.get(this.currMod).getValue0().getModName() + " update out!";
    String version = "new version: " + this.updateMods.get(this.currMod).getValue1();
    String details = "press \247f[" + Keyboard.getKeyName(ClientProxy.KEY_UPDATE_GUI.getKeyCode())
            + "]\247r for details";

    this.mc.renderEngine.bindTexture(this.frameTex);
    int width = Math.max(this.fontRenderer.getStringWidth(update),
            Math.max(this.fontRenderer.getStringWidth(version), this.fontRenderer.getStringWidth(details)))
            + 12;
    int height = 45;

    GL11.glPushMatrix();
    GL11.glScalef(this.scale, this.scale, 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPushMatrix();
    GL11.glScalef(1.0F / 256.0F * 16, 1.0F / 256.0F * 16, 1.0F);
    this.drawTexturedModalRect(0, 0, 0, 0, width * 16, 4 * 16);
    this.drawTexturedModalRect(0, 4 * 16, 0, 4 * 16, 4 * 16, (height - 8) * 16);
    this.drawTexturedModalRect(0, (height - 4) * 16, 0, (height - 4) * 16, width * 16, 4 * 16);
    this.drawTexturedModalRect((width - 4) * 16, 4 * 16, 0, 4 * 16, 4 * 16, (height - 8) * 16);
    GL11.glPopMatrix();
    drawRect(1, 1, width - 1, height - 1, 0x80000000);
    GL11.glPopMatrix();

    if (this.scale >= 1.00F && this.counter > 0) {
        if (!this.mc.isGamePaused()) {
            this.timer.updateTimer();
        }

        int alpha = ((int) (Math.abs(this.txtFade) * 255.0F) & 255) << 24;
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if (alpha != 0) {
            this.drawCenteredString(this.fontRenderer, update, width / 2, 5, 0xFFFF00 | alpha);
            this.drawCenteredString(this.fontRenderer, version, width / 2, 12, 0xA0A0A0 | alpha);
        }
        GL11.glDisable(GL11.GL_BLEND);
        this.drawCenteredString(this.fontRenderer, details, width / 2, 30, 0xA0A0A0);

        this.drawCenteredString(this.fontRenderer, Integer.toString(this.counter), width / 2, height - 4,
                0xFFFFFF);
    } else if (this.counter > 0) {
        this.scale += 0.1F;
    } else if (this.scale > 0.00F) {
        this.scale -= 0.1F;
    }

    if (Math.abs(this.txtFade) < 0.01F) {
        this.currMod++;
        this.txtFade -= 0.1F;
    } else if (Math.abs(this.txtFade) < 1.00F) {
        this.txtFade -= 0.1F;
    } else if (this.txtFade <= -1.00F) {
        this.txtFade = 1.00F;
    }

    if (this.timer.elapsedTicks > 0 && this.counter > 0) {
        this.counter--;
        if (this.counter > 0 && this.counter % 5 == 0) {
            this.txtFade -= 0.1F;
        }
        this.timer.elapsedTicks = 0;
    }
}

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

private static void renderItemIn3D(IIcon icon, boolean withEffect, int spriteIndex) {
    GL11.glPushMatrix();/*www .ja  v a  2  s .c  o m*/

    if (icon == null) {
        GL11.glPopMatrix();
        return;
    }

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();

    Tessellator tessellator = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine
            .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex));

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F,
            false);

    if (withEffect) {
        float baseClr = 0.76F;
        float glintScale = 0.125F;
        float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;

        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);

        Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);
        GL11.glTranslatef(glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);

        glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;

        GL11.glTranslatef(-glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

/**
 * Renders an IIcon in 2D.//from w w  w.  j  ava  2  s.com
 *
 * @param icon        the icon to be rendered
 * @param spriteIndex the index of the texture to be used (0 = blocks, 1 = items)
 * @param hasEffect   if it has an enchantment effect
 * @param isGlowing   if it should glow in the dark
 */
public static void renderIcon(IIcon icon, int spriteIndex, boolean hasEffect, boolean isGlowing) {
    GL11.glPushMatrix();

    if (icon == null) {
        GL11.glPopMatrix();
        return;
    }

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();
    float transX = 0.0F;
    float transY = 0.3F;
    float scale = 1.5F;
    Tessellator tessellator = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine
            .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex));

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-transX, -transY, 0.0F);
    GL11.glScalef(scale, scale, scale);
    GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);

    renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F,
            isGlowing);

    if (hasEffect) {
        float baseClr = 0.76F;
        float glintScale = 0.125F;
        float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;

        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);

        Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);
        GL11.glTranslatef(glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);

        glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;

        GL11.glTranslatef(-glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.event.SoldierBodyRenderHandler.java

License:Creative Commons License

private static void renderStealthEffect(EnumRenderStage stage) {
    if (stage == EnumRenderStage.PRE) {
        GL11.glEnable(GL11.GL_BLEND);//from  w w  w  .  j  a  v  a 2 s. c  om
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    } else {
        GL11.glDisable(GL11.GL_BLEND);
    }
}