Example usage for org.lwjgl.opengl GL11 glPushMatrix

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

Introduction

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

Prototype

public static native void glPushMatrix();

Source Link

Document

Pushes the current matrix stack down by one, duplicating the current matrix in both the top of the stack and the entry below it.

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. ja  va2  s.co 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 renderIn3D(ItemStack stack) {
    GL11.glPushMatrix();

    renderLayerIn3D(ItemGate.getLogic(stack).getIconItem());
    GL11.glScalef(1, 1, 1.05f);//w  w  w .  j a  v a 2 s .co  m
    renderLayerIn3D(ItemGate.getMaterial(stack).getIconItem());

    for (IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) {
        renderLayerIn3D(expansion.getOverlayItem());
    }

    GL11.glPopMatrix();
}

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

License:Minecraft Mod Public

private void renderLayerIn3D(IIcon icon) {
    if (icon == null) {
        return;//from   www.  j a v a  2 s. c  o  m
    }
    GL11.glPushMatrix();
    Tessellator tessellator = Tessellator.instance;

    float uv1 = icon.getMinU();
    float uv2 = icon.getMaxU();
    float uv3 = icon.getMinV();
    float uv4 = icon.getMaxV();

    ItemRenderer.renderItemIn2D(tessellator, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(),
            0.0625F);
    GL11.glPopMatrix();
}

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

License:Minecraft Mod Public

private void renderAsEntity(ItemStack stack, EntityItem entity) {
    GL11.glPushMatrix();
    byte iterations = 1;
    if (stack.stackSize > 1) {
        iterations = 2;//w  ww  .j  av  a  2s. com
    }
    if (stack.stackSize > 15) {
        iterations = 3;
    }
    if (stack.stackSize > 31) {
        iterations = 4;
    }

    Random rand = new Random(187L);

    float offsetZ = 0.0625F + 0.021875F;

    GL11.glRotatef(((entity.age + 1.0F) / 20.0F + entity.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F,
            0.0F);
    GL11.glTranslatef(-0.5F, -0.25F, -(offsetZ * iterations / 2.0F));

    for (int count = 0; count < iterations; ++count) {
        if (count > 0) {
            float offsetX = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float offsetY = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float z = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            GL11.glTranslatef(offsetX, offsetY, offsetZ);
        } else {
            GL11.glTranslatef(0f, 0f, offsetZ);
        }

        renderIn3D(stack);
    }
    GL11.glPopMatrix();
}

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

License:Minecraft Mod Public

private void renderAsEntityFlat(ItemStack stack) {
    GL11.glPushMatrix();
    byte iterations = 1;
    if (stack.stackSize > 1) {
        iterations = 2;//from   w w  w .j a  va  2 s . c  o m
    }
    if (stack.stackSize > 15) {
        iterations = 3;
    }
    if (stack.stackSize > 31) {
        iterations = 4;
    }

    Random rand = new Random(187L);

    for (int ii = 0; ii < iterations; ++ii) {
        GL11.glPushMatrix();
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(180 - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);

        if (ii > 0) {
            float var12 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F;
            float var13 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F;
            float var14 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F;
            GL11.glTranslatef(var12, var13, var14);
        }

        GL11.glTranslatef(0.5f, 0.8f, 0);
        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
        GL11.glScalef(1f / 16f, 1f / 16f, 1);

        render(ItemRenderType.ENTITY, stack);
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}

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

License:Minecraft Mod Public

private void render(ItemRenderType type, ItemStack stack) {
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_LIGHTING);/*from  w ww . j  av a2 s  .  co m*/
    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;//from w  w  w .j  a va2  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();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    //      GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);/*from  www  . j a  va  2s .c  om*/
    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 renderGate(TileGenericPipe tile, IIcon icon, int layer, float trim, float translateCenter,
        float extraDepth) {
    PipeRenderState state = tile.renderState;

    RenderInfo renderBox = new RenderInfo();
    renderBox.texture = icon;/*from  w w  w .j  av  a2s  . co m*/

    float[][] zeroState = new float[3][2];
    float min = CoreConstants.PIPE_MIN_POS + trim / 2F;
    float max = CoreConstants.PIPE_MAX_POS - trim / 2F;

    // X START - END
    zeroState[0][0] = min;
    zeroState[0][1] = max;
    // Y START - END
    zeroState[1][0] = CoreConstants.PIPE_MIN_POS - 0.10F - 0.001F * layer;
    zeroState[1][1] = CoreConstants.PIPE_MIN_POS + 0.001F + 0.01F * layer + extraDepth;
    // Z START - END
    zeroState[2][0] = min;
    zeroState[2][1] = max;

    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
        if (shouldRenderNormalPipeSide(state, direction)) {
            GL11.glPushMatrix();

            float xt = direction.offsetX * translateCenter, yt = direction.offsetY * translateCenter,
                    zt = direction.offsetZ * translateCenter;

            GL11.glTranslatef(xt, yt, zt);

            float[][] rotated = MatrixTranformations.deepClone(zeroState);
            MatrixTranformations.transform(rotated, direction);

            if (layer != 0) {
                renderBox.setRenderSingleSide(direction.ordinal());
            }
            renderBox.setBounds(rotated[0][0], rotated[1][0], rotated[2][0], rotated[0][1], rotated[1][1],
                    rotated[2][1]);
            RenderEntityBlock.INSTANCE.renderBlock(renderBox, tile.getWorldObj(), 0, 0, 0, tile.xCoord,
                    tile.yCoord, tile.zCoord, true, true);
            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();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);//from   w  w w .j a v  a  2s .c  o m
    //      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();
}