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.render.FacadeItemRenderer.java

License:Minecraft Mod Public

private void renderFacadeItem(RenderBlocks render, ItemStack item, float translateX, float translateY,
        float translateZ) {
    if (lastTime < System.currentTimeMillis()) {
        renderState = !renderState;//from   w w  w .j a va 2 s  . c o m
        lastTime = System.currentTimeMillis() + 1000L;
    }

    Block block = null;
    int decodedMeta = 0;

    int type = ItemFacade.getType(item);
    Block[] blocks = ItemFacade.getBlocks(item);
    int[] metas = ItemFacade.getMetaValues(item);
    if (blocks == null || blocks.length == 0 || metas == null || metas.length != blocks.length) {
        return;
    }

    if (type == ItemFacade.TYPE_BASIC || (type == ItemFacade.TYPE_PHASED && renderState)) {
        block = blocks[0];
        decodedMeta = metas[0];
    } else if (type == ItemFacade.TYPE_PHASED && blocks.length >= 2) {
        block = blocks[1];
        decodedMeta = metas[1];
    }

    try {
        int color = item.getItem().getColorFromItemStack(new ItemStack(block, 1, decodedMeta), 0);
        RenderUtils.setGLColorFromInt(color);
    } catch (Throwable error) {
    }

    Tessellator tessellator = Tessellator.instance;

    if (block == null) {
        return;
    }

    if (tryGetBlockIcon(block, 0, decodedMeta) == null) {
        return;
    }

    // Render Facade
    GL11.glPushMatrix();

    // Enable glBlending for transparency
    if (block.getRenderBlockPass() > 0) {
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    }

    block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F);
    render.setRenderBoundsFromBlock(block);
    GL11.glTranslatef(translateX, translateY, translateZ);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1F, 0.0F);
    render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 0, decodedMeta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 1, decodedMeta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1F);
    render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 2, decodedMeta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 3, decodedMeta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1F, 0.0F, 0.0F);
    render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 4, decodedMeta));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 5, decodedMeta));
    tessellator.draw();
    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);

    // Disable blending
    if (block.getRenderBlockPass() > 0) {
        GL11.glDisable(GL11.GL_BLEND);
    }

    GL11.glPopMatrix();

    // Render StructurePipe
    block = BuildCraftTransport.genericPipeBlock;
    IIcon textureID = BuildCraftTransport.instance.pipeIconProvider
            .getIcon(PipeIconProvider.TYPE.PipeStructureCobblestone.ordinal()); // Structure pipe

    block.setBlockBounds(CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MIN_POS, CoreConstants.PIPE_MIN_POS,
            CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MAX_POS, CoreConstants.PIPE_MAX_POS - 1F / 16F);
    block.setBlockBoundsForItemRender();
    render.setRenderBoundsFromBlock(block);
    GL11.glTranslatef(translateX, translateY, translateZ + 0.25F);

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -0F, 0.0F);
    render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, textureID);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, textureID);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1F);
    render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, textureID);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, textureID);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1F, 0.0F, 0.0F);
    render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, textureID);
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, textureID);
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}

From source file:buildcraft.transport.render.GateItemRenderer.java

License:Minecraft Mod Public

private void render(ItemRenderType type, ItemStack stack) {
    GL11.glPushMatrix();//from   ww  w  . j a v  a  2s .  co  m
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_ALPHA_TEST); // In certain cases gets disabled by this point
    IIcon icon = ItemGate.getLogic(stack).getIconItem();
    renderItem.renderIcon(0, 0, icon, 16, 16);

    if (type == ItemRenderType.ENTITY) {
        GL11.glTranslatef(0, 0, -0.01f);
    }

    icon = ItemGate.getMaterial(stack).getIconItem();
    if (icon != null) {
        renderItem.renderIcon(0, 0, icon, 16, 16);
    }

    for (IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) {
        icon = expansion.getOverlayItem();
        if (icon != null) {
            renderItem.renderIcon(0, 0, icon, 16, 16);
        }
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.PipeRendererTESR.java

License:Minecraft Mod Public

private void pipeWireRender(TileGenericPipe pipe, float cx, float cy, float cz, PipeWire color, double x,
        double y, double z) {

    PipeRenderState state = pipe.renderState;

    float minX = CoreConstants.PIPE_MIN_POS;
    float minY = CoreConstants.PIPE_MIN_POS;
    float minZ = CoreConstants.PIPE_MIN_POS;

    float maxX = CoreConstants.PIPE_MAX_POS;
    float maxY = CoreConstants.PIPE_MAX_POS;
    float maxZ = CoreConstants.PIPE_MAX_POS;

    boolean foundX = false, foundY = false, foundZ = false;

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.WEST)) {
        minX = 0;//  w w  w  .  ja v  a2 s  .c o m
        foundX = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.EAST)) {
        maxX = 1;
        foundX = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.DOWN)) {
        minY = 0;
        foundY = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.UP)) {
        maxY = 1;
        foundY = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.NORTH)) {
        minZ = 0;
        foundZ = true;
    }

    if (state.wireMatrix.isWireConnected(color, ForgeDirection.SOUTH)) {
        maxZ = 1;
        foundZ = true;
    }

    boolean center = false;

    if (minX == 0 && maxX != 1 && (foundY || foundZ)) {
        if (cx == CoreConstants.PIPE_MIN_POS) {
            maxX = CoreConstants.PIPE_MIN_POS;
        } else {
            center = true;
        }
    }

    if (minX != 0 && maxX == 1 && (foundY || foundZ)) {
        if (cx == CoreConstants.PIPE_MAX_POS) {
            minX = CoreConstants.PIPE_MAX_POS;
        } else {
            center = true;
        }
    }

    if (minY == 0 && maxY != 1 && (foundX || foundZ)) {
        if (cy == CoreConstants.PIPE_MIN_POS) {
            maxY = CoreConstants.PIPE_MIN_POS;
        } else {
            center = true;
        }
    }

    if (minY != 0 && maxY == 1 && (foundX || foundZ)) {
        if (cy == CoreConstants.PIPE_MAX_POS) {
            minY = CoreConstants.PIPE_MAX_POS;
        } else {
            center = true;
        }
    }

    if (minZ == 0 && maxZ != 1 && (foundX || foundY)) {
        if (cz == CoreConstants.PIPE_MIN_POS) {
            maxZ = CoreConstants.PIPE_MIN_POS;
        } else {
            center = true;
        }
    }

    if (minZ != 0 && maxZ == 1 && (foundX || foundY)) {
        if (cz == CoreConstants.PIPE_MAX_POS) {
            minZ = CoreConstants.PIPE_MAX_POS;
        } else {
            center = true;
        }
    }

    boolean found = foundX || foundY || foundZ;

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    RenderHelper.disableStandardItemLighting();

    GL11.glColor3f(1, 1, 1);
    GL11.glTranslatef((float) x, (float) y, (float) z);

    float scale = 1.001f;
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    bindTexture(TextureMap.locationBlocksTexture);

    RenderInfo renderBox = new RenderInfo();
    renderBox.texture = BuildCraftTransport.instance.wireIconProvider
            .getIcon(state.wireMatrix.getWireIconIndex(color));

    // Z render

    if (minZ != CoreConstants.PIPE_MIN_POS || maxZ != CoreConstants.PIPE_MAX_POS || !found) {
        renderBox.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx,
                cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, minZ,
                cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F,
                cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, maxZ);
        RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    // X render

    if (minX != CoreConstants.PIPE_MIN_POS || maxX != CoreConstants.PIPE_MAX_POS || !found) {
        renderBox.setBounds(minX, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy,
                cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, maxX,
                cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F,
                cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F);
        RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    // Y render

    if (minY != CoreConstants.PIPE_MIN_POS || maxY != CoreConstants.PIPE_MAX_POS || !found) {
        renderBox.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, minY,
                cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz,
                cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, maxY,
                cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F);
        RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    if (center || !found) {
        renderBox.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx,
                cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy,
                cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz,
                cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F,
                cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F,
                cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F);
        RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord,
                pipe.zCoord, true, true);
    }

    RenderHelper.enableStandardItemLighting();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.PipeRendererTESR.java

License:Minecraft Mod Public

private void pipeGateRender(TileGenericPipe pipe, double x, double y, double z) {
    GL11.glPushMatrix();//www  .  j a v a 2  s .co m
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    //      GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    //      GL11.glDisable(GL11.GL_TEXTURE_2D);
    RenderHelper.disableStandardItemLighting();

    GL11.glColor3f(1, 1, 1);
    GL11.glTranslatef((float) x, (float) y, (float) z);

    bindTexture(TextureMap.locationBlocksTexture);

    IIcon iconLogic;
    if (pipe.renderState.isGateLit()) {
        iconLogic = pipe.pipe.gate.logic.getIconLit();
    } else {
        iconLogic = pipe.pipe.gate.logic.getIconDark();
    }

    float translateCenter = 0;

    // Render base gate
    renderGate(pipe, iconLogic, 0, 0.1F, 0, 0);

    float pulseStage = pipe.pipe.gate.getPulseStage() * 2F;

    if (pipe.renderState.isGatePulsing() || pulseStage != 0) {
        // Render pulsing gate
        float amplitude = 0.10F;
        float start = 0.01F;

        if (pulseStage < 1) {
            translateCenter = (pulseStage * amplitude) + start;
        } else {
            translateCenter = amplitude - ((pulseStage - 1F) * amplitude) + start;
        }

        renderGate(pipe, iconLogic, 0, 0.13F, translateCenter, translateCenter);
    }

    IIcon materialIcon = pipe.pipe.gate.material.getIconBlock();
    if (materialIcon != null) {
        renderGate(pipe, materialIcon, 1, 0.13F, translateCenter, translateCenter);
    }

    for (IGateExpansion expansion : pipe.pipe.gate.expansions.keySet()) {
        renderGate(pipe, expansion.getOverlayBlock(), 2, 0.13F, translateCenter, translateCenter);
    }

    RenderHelper.enableStandardItemLighting();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.PipeRendererTESR.java

License:Minecraft Mod Public

private void renderPower(Pipe<PipeTransportPower> pipe, double x, double y, double z) {
    initializeDisplayPowerList(pipe.container.getWorldObj());

    PipeTransportPower pow = pipe.transport;

    GL11.glPushMatrix();//from   w w w.ja  va  2  s . co  m
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    //      GL11.glEnable(GL11.GL_BLEND);

    GL11.glTranslatef((float) x, (float) y, (float) z);

    bindTexture(TextureMap.locationBlocksTexture);

    int[] displayList = pow.overload > 0 ? displayPowerListOverload : displayPowerList;

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

        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        GL11.glRotatef(angleY[side], 0, 1, 0);
        GL11.glRotatef(angleZ[side], 0, 0, 1);
        float scale = 1.0F - side * 0.0001F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

        short stage = pow.clientDisplayPower[side];
        if (stage >= 1) {
            if (stage < displayList.length) {
                GL11.glCallList(displayList[stage]);
            } else {
                GL11.glCallList(displayList[displayList.length - 1]);
            }
        }

        GL11.glPopMatrix();
    }

    /*bindTexture(STRIPES_TEXTURE);
            
    for (int side = 0; side < 6; side += 2) {
       if (pipe.container.isPipeConnected(ForgeDirection.values()[side])) {
    GL11.glPushMatrix();
            
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
            
    GL11.glRotatef(angleY[side], 0, 1, 0);
    GL11.glRotatef(angleZ[side], 0, 0, 1);
            
    float scale = 1.0F - side * 0.0001F;
    GL11.glScalef(scale, scale, scale);
            
    float movement = (0.50F) * pipe.transport.getPistonStage(side / 2);
    GL11.glTranslatef(-0.25F - 1F / 16F - movement, -0.5F, -0.5F);
            
    // float factor = (float) (1.0 / 256.0);
    float factor = (float) (1.0 / 16.0);
    box.render(factor);
    GL11.glPopMatrix();
       }
    }*/

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.PipeRendererTESR.java

License:Minecraft Mod Public

private void renderFluids(Pipe<PipeTransportFluids> pipe, double x, double y, double z) {
    PipeTransportFluids trans = pipe.transport;

    boolean needsRender = false;
    for (int i = 0; i < 7; ++i) {
        FluidStack fluidStack = trans.renderCache[i];
        if (fluidStack != null && fluidStack.amount > 0) {
            needsRender = true;/*from   w  w w.j av a  2 s. co  m*/
            break;
        }
    }

    if (!needsRender) {
        return;
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslatef((float) x, (float) y, (float) z);

    // sides

    boolean sides = false, above = false;

    for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
        int i = side.ordinal();

        FluidStack fluidStack = trans.renderCache[i];

        if (fluidStack == null || fluidStack.amount <= 0) {
            continue;
        }

        if (!pipe.container.isPipeConnected(side)) {
            continue;
        }

        DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj());

        if (d == null) {
            continue;
        }

        int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));

        GL11.glPushMatrix();
        int list = 0;

        switch (ForgeDirection.VALID_DIRECTIONS[i]) {
        case UP:
            above = true;
            list = d.sideVertical[stage];
            break;
        case DOWN:
            GL11.glTranslatef(0, -0.75F, 0);
            list = d.sideVertical[stage];
            break;
        case EAST:
        case WEST:
        case SOUTH:
        case NORTH:
            sides = true;
            // Yes, this is kind of ugly, but was easier than transform the coordinates above.
            GL11.glTranslatef(0.5F, 0.0F, 0.5F);
            GL11.glRotatef(angleY[i], 0, 1, 0);
            GL11.glRotatef(angleZ[i], 0, 0, 1);
            GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
            list = d.sideHorizontal[stage];
            break;
        default:
        }
        bindTexture(TextureMap.locationBlocksTexture);
        RenderUtils.setGLColorFromInt(trans.colorRenderCache[i]);
        GL11.glCallList(list);
        GL11.glPopMatrix();
    }
    // CENTER
    FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()];

    if (fluidStack != null && fluidStack.amount > 0) {
        DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj());

        if (d != null) {
            int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1));

            bindTexture(TextureMap.locationBlocksTexture);
            RenderUtils.setGLColorFromInt(trans.colorRenderCache[ForgeDirection.UNKNOWN.ordinal()]);

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

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

    }

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.PipeRendererTESR.java

License:Minecraft Mod Public

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

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

    int count = 0;
    for (TravelingItem item : pipe.transport.items) {
        if (count >= MAX_ITEMS_TO_RENDER) {
            break;
        }

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

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

From source file:buildcraft.transport.render.RenderPipe.java

License:Minecraft Mod Public

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

    GL11.glPushMatrix();/*from  w  ww.  j a  v a2 s .  co m*/
    GL11.glDisable(2896 /* GL_LIGHTING */);

    ForgeHooksClient.bindTexture(DefaultProps.TEXTURE_BLOCKS, 0);

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

    int[] displayList = pow.overload ? displayPowerListOverload : displayPowerList;

    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) {
            short stage = pow.displayPower[i];

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

        GL11.glPopMatrix();
    }

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

From source file:buildcraft.transport.render.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  a va2s.  c  om
    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) (liq.getCapacity()) * (LIQUID_STAGES - 1));

            GL11.glPushMatrix();
            int list = 0;

            switch (ForgeDirection.VALID_DIRECTIONS[i]) {
            case UP:
                above = true;
                list = d.sideVertical[stage];
                break;
            case DOWN:
                GL11.glTranslatef(0, -0.75F, 0);
                list = d.sideVertical[stage];
                break;
            case EAST:
            case WEST:
            case SOUTH:
            case NORTH:
                sides = true;
                GL11.glRotatef(angleY[i], 0, 1, 0);
                GL11.glRotatef(angleZ[i], 0, 0, 1);
                list = d.sideHorizontal[stage];
                break;
            default:
            }

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

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

        if (d != null) {
            int stage = (int) ((float) liquid.amount / (float) (liq.getCapacity()) * (LIQUID_STAGES - 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.render.RenderPipe.java

License:Minecraft Mod Public

private void renderSolids(Pipe pipe, double x, double y, double z) {
    GL11.glPushMatrix();//from  ww w . ja va 2  s. c om
    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 >= MAX_ITEMS_TO_RENDER) {
            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();
}