Example usage for org.lwjgl.opengl GL11 glDisable

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

Introduction

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

Prototype

public static void glDisable(@NativeType("GLenum") int target) 

Source Link

Document

Disables the specified OpenGL state.

Usage

From source file:buildcraft.transport.RenderPipe.java

License:Minecraft Mod Public

private void renderPower(Pipe pipe, double x, double y, double z) {
    PipeTransportPower pow = (PipeTransportPower) pipe.transport;

    GL11.glPushMatrix();/*  w  w w .  j a v  a2  s . c o  m*/
    GL11.glDisable(2896 /* GL_LIGHTING */);

    MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_BLOCKS);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);

    for (int i = 0; i < 6; ++i) {
        GL11.glPushMatrix();

        GL11.glRotatef(angleY[i], 0, 1, 0);
        GL11.glRotatef(angleZ[i], 0, 0, 1);

        if (pow.displayPower[i] >= 1.0) {
            int stage = 0;

            for (; stage < displayPowerStages; ++stage)
                if (displayPowerLimits[stage] > pow.displayPower[i])
                    break;

            if (stage < displayPowerList.length)
                GL11.glCallList(displayPowerList[stage]);
            else
                GL11.glCallList(displayPowerList[displayPowerList.length - 1]);
        }

        GL11.glPopMatrix();
    }

    GL11.glEnable(2896 /* GL_LIGHTING */);
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.RenderPipe.java

License:Minecraft Mod Public

private void renderLiquids(Pipe pipe, double x, double y, double z) {
    PipeTransportLiquids liq = (PipeTransportLiquids) pipe.transport;

    GL11.glPushMatrix();//from w  w w.j  ava2s  . co m
    GL11.glDisable(2896 /* GL_LIGHTING */);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);

    // sides

    boolean sides = false, above = false;

    for (int i = 0; i < 6; ++i) {
        //ILiquidTank tank = liq.getTanks()[i];
        //LiquidStack liquid = tank.getLiquid();
        LiquidStack liquid = liq.renderCache[i];
        //int amount = liquid != null ? liquid.amount : 0;
        //int amount = liquid != null ? liq.renderAmmount[i] : 0;

        if (liquid != null && liquid.amount > 0) {
            DisplayLiquidList d = getListFromBuffer(liquid, pipe.worldObj);

            if (d == null)
                continue;

            int stage = (int) ((float) liquid.amount / (float) (PipeTransportLiquids.LIQUID_IN_PIPE)
                    * (displayLiquidStages - 1));

            GL11.glPushMatrix();
            int list = 0;

            switch (Orientations.values()[i]) {
            case YPos:
                above = true;
                list = d.sideVertical[stage];
                break;
            case YNeg:
                GL11.glTranslatef(0, -0.75F, 0);
                list = d.sideVertical[stage];
                break;
            case XPos:
            case XNeg:
            case ZPos:
            case ZNeg:
                sides = true;
                GL11.glRotatef(angleY[i], 0, 1, 0);
                GL11.glRotatef(angleZ[i], 0, 0, 1);
                list = d.sideHorizontal[stage];
                break;
            }

            GL11.glCallList(list);
            GL11.glPopMatrix();
        }
    }
    // CENTER
    //      ILiquidTank tank = liq.getTanks()[Orientations.Unknown.ordinal()];
    //      LiquidStack liquid = tank.getLiquid();
    LiquidStack liquid = liq.renderCache[Orientations.Unknown.ordinal()];

    //int amount = liquid != null ? liquid.amount : 0; 
    //int amount = liquid != null ? liq.renderAmmount[Orientations.Unknown.ordinal()] : 0;
    if (liquid != null && liquid.amount > 0) {
        //DisplayLiquidList d = getListFromBuffer(liq.getTanks()[Orientations.Unknown.ordinal()].getLiquid(), pipe.worldObj);
        DisplayLiquidList d = getListFromBuffer(liquid, pipe.worldObj);

        if (d != null) {
            int stage = (int) ((float) liquid.amount / (float) (PipeTransportLiquids.LIQUID_IN_PIPE)
                    * (displayLiquidStages - 1));

            if (above)
                GL11.glCallList(d.centerVertical[stage]);

            if (!above || sides)
                GL11.glCallList(d.centerHorizontal[stage]);
        }

    }

    GL11.glEnable(2896 /* GL_LIGHTING */);
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.RenderPipe.java

License:Minecraft Mod Public

private void renderSolids(Pipe pipe, double x, double y, double z) {
    GL11.glPushMatrix();/*from  w w  w.  ja v a  2  s. c  o m*/
    GL11.glDisable(2896 /* GL_LIGHTING */);

    float light = pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord);

    int count = 0;
    for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values()) {
        if (count >= numItemsToRender)
            break;

        doRenderItem(data.item, x + data.item.getPosition().x - pipe.xCoord,
                y + data.item.getPosition().y - pipe.yCoord, z + data.item.getPosition().z - pipe.zCoord,
                light);
        count++;
    }

    GL11.glEnable(2896 /* GL_LIGHTING */);
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.RenderPipe.java

License:Minecraft Mod Public

public void doRenderItem(IPipedItem entityitem, double d, double d1, double d2, float f1) {

    if (entityitem == null || entityitem.getItemStack() == null)
        return;/*from  www. ja  va 2 s  . c o m*/

    ItemStack itemstack = entityitem.getItemStack();
    random.setSeed(187L);

    GL11.glPushMatrix();

    byte quantity = 1;
    if (entityitem.getItemStack().stackSize > 1)
        quantity = 2;

    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */);

    IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.ENTITY);

    if (customRenderer != null) {

        GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC
        loadTexture("/terrain.png");
        ForgeHooksClient.overrideTexture(itemstack.getItem());
        float f4 = 0.25F;
        f4 = 0.5F;
        GL11.glScalef(f4, f4, f4);

        for (int j = 0; j < quantity; j++) {

            GL11.glPushMatrix();

            if (j > 0) {
                float f5 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f7 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                GL11.glTranslatef(f5, f7, f9);
            }

            RenderPipe.dummyEntityItem.item = itemstack;

            customRenderer.renderItem(ItemRenderType.ENTITY, itemstack, renderBlocks,
                    RenderPipe.dummyEntityItem);
            GL11.glPopMatrix();
        }

    } else if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null
            && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) {

        GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC
        loadTexture("/terrain.png");
        ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
        float f4 = 0.25F;
        int j = Block.blocksList[itemstack.itemID].getRenderType();
        if (j == 1 || j == 19 || j == 12 || j == 2)
            f4 = 0.5F;

        GL11.glScalef(f4, f4, f4);
        for (int k = 0; k < quantity; k++) {
            GL11.glPushMatrix();

            if (k > 0) {
                float f6 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                float f11 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4;
                GL11.glTranslatef(f6, f9, f11);
            }

            float f7 = 1.0F;
            renderBlocks.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), f7);
            GL11.glPopMatrix();
        }

    } else {
        GL11.glTranslatef(0, 0.10F, 0); // BC SPECIFIC

        if (itemstack.getItem().requiresMultipleRenderPasses()) {
            GL11.glScalef(0.5F, 0.5F, 0.5F);
            this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID]));

            for (int i = 0; i <= 1; ++i) {
                int iconIndex = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(),
                        i);
                float scale = 1.0F;

                if (true) {
                    int var17 = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(),
                            i);
                    float var18 = (var17 >> 16 & 255) / 255.0F;
                    float var19 = (var17 >> 8 & 255) / 255.0F;
                    float var20 = (var17 & 255) / 255.0F;
                    GL11.glColor4f(var18 * scale, var19 * scale, var20 * scale, 1.0F);
                }

                this.drawItem(iconIndex, quantity);
            }
        } else {

            GL11.glScalef(0.5F, 0.5F, 0.5F);
            int i = itemstack.getIconIndex();
            if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null) {
                loadTexture("/terrain.png");
                ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]);
            } else {
                loadTexture("/gui/items.png");
                ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]);
            }

            drawItem(i, quantity);
        }

    }
    GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.models.ModelKineticDuster.java

License:GNU General Public License

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    this.cube.render(f5);
    this.shape11_2.render(f5);
    GL11.glPushMatrix();/*w w  w  . j  a va  2s . com*/
    GL11.glTranslatef(this.shape24_3.offsetX, this.shape24_3.offsetY, this.shape24_3.offsetZ);
    GL11.glTranslatef(this.shape24_3.rotationPointX * f5, this.shape24_3.rotationPointY * f5,
            this.shape24_3.rotationPointZ * f5);
    GL11.glScaled(1.0D, 6.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_3.offsetX, -this.shape24_3.offsetY, -this.shape24_3.offsetZ);
    GL11.glTranslatef(-this.shape24_3.rotationPointX * f5, -this.shape24_3.rotationPointY * f5,
            -this.shape24_3.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_3.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    this.shape11_7.render(f5);
    this.shape11_5.render(f5);
    this.shape11_1.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_1.offsetX, this.shape24_1.offsetY, this.shape24_1.offsetZ);
    GL11.glTranslatef(this.shape24_1.rotationPointX * f5, this.shape24_1.rotationPointY * f5,
            this.shape24_1.rotationPointZ * f5);
    GL11.glScaled(1.0D, 6.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_1.offsetX, -this.shape24_1.offsetY, -this.shape24_1.offsetZ);
    GL11.glTranslatef(-this.shape24_1.rotationPointX * f5, -this.shape24_1.rotationPointY * f5,
            -this.shape24_1.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_1.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_2.offsetX, this.shape24_2.offsetY, this.shape24_2.offsetZ);
    GL11.glTranslatef(this.shape24_2.rotationPointX * f5, this.shape24_2.rotationPointY * f5,
            this.shape24_2.rotationPointZ * f5);
    GL11.glScaled(1.0D, 6.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_2.offsetX, -this.shape24_2.offsetY, -this.shape24_2.offsetZ);
    GL11.glTranslatef(-this.shape24_2.rotationPointX * f5, -this.shape24_2.rotationPointY * f5,
            -this.shape24_2.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_2.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_5.offsetX, this.shape24_5.offsetY, this.shape24_5.offsetZ);
    GL11.glTranslatef(this.shape24_5.rotationPointX * f5, this.shape24_5.rotationPointY * f5,
            this.shape24_5.rotationPointZ * f5);
    GL11.glScaled(14.0D, 1.0D, 14.0D);
    GL11.glTranslatef(-this.shape24_5.offsetX, -this.shape24_5.offsetY, -this.shape24_5.offsetZ);
    GL11.glTranslatef(-this.shape24_5.rotationPointX * f5, -this.shape24_5.rotationPointY * f5,
            -this.shape24_5.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_5.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    this.shape11_4.render(f5);
    this.shape11_3.render(f5);
    this.shape11_6.render(f5);
    this.shape11.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24.offsetX, this.shape24.offsetY, this.shape24.offsetZ);
    GL11.glTranslatef(this.shape24.rotationPointX * f5, this.shape24.rotationPointY * f5,
            this.shape24.rotationPointZ * f5);
    GL11.glScaled(14.0D, 6.0D, 1.0D);
    GL11.glTranslatef(-this.shape24.offsetX, -this.shape24.offsetY, -this.shape24.offsetZ);
    GL11.glTranslatef(-this.shape24.rotationPointX * f5, -this.shape24.rotationPointY * f5,
            -this.shape24.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape24_4.offsetX, this.shape24_4.offsetY, this.shape24_4.offsetZ);
    GL11.glTranslatef(this.shape24_4.rotationPointX * f5, this.shape24_4.rotationPointY * f5,
            this.shape24_4.rotationPointZ * f5);
    GL11.glScaled(14.0D, 6.0D, 1.0D);
    GL11.glTranslatef(-this.shape24_4.offsetX, -this.shape24_4.offsetY, -this.shape24_4.offsetZ);
    GL11.glTranslatef(-this.shape24_4.rotationPointX * f5, -this.shape24_4.rotationPointY * f5,
            -this.shape24_4.rotationPointZ * f5);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.2F);
    this.shape24_4.render(f5);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:buildcraftAdditions.client.render.BucketItemRenderer.java

License:GNU General Public License

private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type, boolean flip) {
    if (mask == null || subIcon == null)
        return;/*from  ww  w.  j a  v a 2s  .c o m*/

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_CULL_FACE);
    Tessellator tessellator = Tessellator.instance;

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, 1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, 0.001, flip);
    else
        preRenderWorldIcon(mask, 0.001, flip);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, -1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, -0.0635, flip);
    else
        preRenderWorldIcon(mask, -0.0635, flip);
    tessellator.draw();

    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET);
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDepthMask(false);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, 1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, 0.001, flip);
    else
        preRenderWorldIcon(subIcon, 0.001, flip);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, -1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, -0.0635, flip);
    else
        preRenderWorldIcon(subIcon, -0.0635, flip);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glColor4f(1, 1, 1, 1);
}

From source file:buildcraftAdditions.client.render.CanisterItemRender.java

License:GNU General Public License

private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) {
    if (mask == null || subIcon == null)
        return;/*  ww w  . j a v a 2  s .com*/

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    Tessellator tessellator = Tessellator.instance;

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, 0.001D);
    else
        preRenderWorldIcon(mask, 0.001D);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, -0.0635D);
    else
        preRenderWorldIcon(mask, -0.0635D);
    tessellator.draw();

    Minecraft.getMinecraft().renderEngine.bindTexture(BLOCK_TEXTURE);
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDepthMask(false);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, 0.001D);
    else
        preRenderWorldIcon(subIcon, 0.001D);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, -0.0635D);
    else
        preRenderWorldIcon(subIcon, -0.0635D);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}

From source file:buildcraftAdditions.client.render.entities.EntityLaserShotRenderer.java

License:GNU General Public License

private void doRender(EntityLaserShot entity, double x, double y, double z, float rotation,
        float partialTicks) {
    bindEntityTexture(entity);//  www .j a  v a  2  s.c  o  m
    GL11.glPushMatrix();
    float strength = entity.getStrength();
    if (strength >= 1)
        GL11.glColor3f(1, 0, 0);
    else if (strength > 0.75)
        GL11.glColor3f(0.75F, 0, 0.25F);
    else if (strength > 0.6)
        GL11.glColor3f(0.5F, 0, 0.5F);
    else if (strength > 0.35)
        GL11.glColor3f(0.25F, 0, 0.75F);
    else
        GL11.glColor3f(0, 0, 1);
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90,
            0, 1, 0);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks,
            0, 0, 1);
    Tessellator t = Tessellator.instance;
    double d1 = 0;
    double d2 = 0.5;
    double d3 = 0 / 32D;
    double d4 = 5 / 32D;
    double d5 = 0.05625;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    float f1 = entity.throwableShake - partialTicks;
    if (f1 > 0) {
        float f2 = -MathHelper.sin(f1 * 3) * f1;
        GL11.glRotatef(f2, 0, 0, 1);
    }

    GL11.glRotatef(45, 1, 0, 0);
    GL11.glScaled(d5, d5, d5);
    GL11.glTranslatef(-4, 0, 0);
    for (int i = 0; i < 4; i++) {
        GL11.glRotatef(90, 1, 0, 0);
        GL11.glNormal3d(0, 0, d5);
        t.startDrawingQuads();
        t.addVertexWithUV(-8, -2, 0, d1, d3);
        t.addVertexWithUV(8, -2, 0, d2, d3);
        t.addVertexWithUV(8, 2, 0, d2, d4);
        t.addVertexWithUV(-8, 2, 0, d1, d4);
        t.draw();
    }

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

From source file:buildcraftAdditions.client.render.items.CanisterItemRender.java

License:GNU General Public License

private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) {
    if (mask == null || subIcon == null)
        return;// w  w  w  . java  2s.co  m

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_CULL_FACE);
    Tessellator tessellator = Tessellator.instance;

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, 1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, 0.001);
    else
        preRenderWorldIcon(mask, 0.001);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, -1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, -0.0635);
    else
        preRenderWorldIcon(mask, -0.0635);
    tessellator.draw();

    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET);
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDepthMask(false);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, 1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, 0.001);
    else
        preRenderWorldIcon(subIcon, 0.001);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0, 0, -1);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, -0.0635);
    else
        preRenderWorldIcon(subIcon, -0.0635);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glColor4f(1, 1, 1, 1);
}

From source file:buildcraftAdditions.client.render.KineticToolItemRender.java

License:GNU General Public License

private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) {
    if (mask == null || subIcon == null)
        return;/*from www.j  a  v a2s  .c  om*/

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    Tessellator tessellator = Tessellator.instance;

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, 0.001D);
    else
        preRenderWorldIcon(mask, 0.001D);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(mask, -0.0635D);
    else
        preRenderWorldIcon(mask, -0.0635D);
    tessellator.draw();

    Minecraft.getMinecraft().renderEngine.bindTexture(BLOCK_TEXTURE);
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDepthMask(false);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, 0.001D);
    else
        preRenderWorldIcon(subIcon, 0.001D);
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    if (type.equals(ItemRenderType.INVENTORY))
        preRenderInvIcon(subIcon, -0.0635D);
    else
        preRenderWorldIcon(subIcon, -0.0635D);
    tessellator.draw();

    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

}