Example usage for org.lwjgl.opengl GL11 glCallList

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

Introduction

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

Prototype

public static native void glCallList(@NativeType("GLuint") int list);

Source Link

Document

Executes a display list.

Usage

From source file:buildcraft.factory.RenderRefinery.java

License:Minecraft Mod Public

private void render(TileRefinery tile, double x, double y, double z) {

    int liquid1 = 0, liquid2 = 0, liquid3 = 0;
    int qty1 = 0, qty2 = 0, qty3 = 0;
    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = magnet[0];

    if (tile != null) {
        liquid1 = tile.slot1.liquidId;/*w  w  w .j  a  va  2s.  c  o m*/
        qty1 = tile.slot1.quantity;

        liquid2 = tile.slot2.liquidId;
        qty2 = tile.slot2.quantity;

        liquid3 = tile.result.liquidId;
        qty3 = tile.result.quantity;

        anim = tile.getAnimationStage();

        switch (tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) {
        case 2:
            angle = 90;
            break;
        case 3:
            angle = 270;
            break;
        case 4:
            angle = 180;
            break;
        case 5:
            angle = 0;
            break;
        }

        if (tile.animationSpeed <= 1)
            theMagnet = magnet[0];
        else if (tile.animationSpeed <= 2.5)
            theMagnet = magnet[1];
        else if (tile.animationSpeed <= 4.5)
            theMagnet = magnet[2];
        else
            theMagnet = magnet[3];

    }

    GL11.glPushMatrix();
    GL11.glDisable(2896 /* GL_LIGHTING */);

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

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(angle, 0, 1, 0);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_PATH_BLOCKS + "/refinery.png");
    GL11.glTranslatef(-4F * factor, 0, -4F * factor);
    tank.render(factor);
    GL11.glTranslatef(4F * factor, 0, 4F * factor);

    GL11.glTranslatef(-4F * factor, 0, 4F * factor);
    tank.render(factor);
    GL11.glTranslatef(4F * factor, 0, -4F * factor);

    GL11.glTranslatef(4F * factor, 0, 0);
    tank.render(factor);
    GL11.glTranslatef(-4F * factor, 0, 0);

    float trans1, trans2;

    if (anim <= 100) {
        trans1 = 12F * factor * anim / 100F;
        trans2 = 0;
    } else if (anim <= 200) {
        trans1 = 12F * factor - (12F * factor * (anim - 100F) / 100F);
        trans2 = 12F * factor * (anim - 100F) / 100F;
    } else {
        trans1 = 12F * factor * (anim - 200F) / 100F;
        trans2 = 12F * factor - (12F * factor * (anim - 200F) / 100F);
    }

    GL11.glTranslatef(0, trans1, 0);
    theMagnet.render(factor);
    GL11.glTranslatef(0, -trans1, 0);

    GL11.glTranslatef(0, trans2, 12F * factor);
    theMagnet.render(factor);
    GL11.glTranslatef(0, -trans2, -12F * factor);

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

    GL11.glTranslatef(-4F * factor, 0, -4F * factor);
    if (qty1 > 0) {
        int[] list1 = getDisplayLists(liquid1, tile.worldObj);

        if (list1 != null) {
            setTextureFor(liquid1);
            GL11.glCallList(
                    list1[(int) ((float) qty1 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]);
        }
    }
    GL11.glTranslatef(4F * factor, 0, 4F * factor);

    GL11.glTranslatef(-4F * factor, 0, 4F * factor);
    if (qty2 > 0) {
        int[] list2 = getDisplayLists(liquid2, tile.worldObj);

        if (list2 != null) {
            setTextureFor(liquid2);
            GL11.glCallList(
                    list2[(int) ((float) qty2 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]);
        }
    }
    GL11.glTranslatef(4F * factor, 0, -4F * factor);

    GL11.glTranslatef(4F * factor, 0, 0);
    if (qty3 > 0) {
        int[] list3 = getDisplayLists(liquid3, tile.worldObj);

        if (list3 != null) {
            setTextureFor(liquid3);
            GL11.glCallList(getDisplayLists(liquid3, tile.worldObj)[(int) ((float) qty3
                    / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]);
        }
    }
    GL11.glTranslatef(-4F * factor, 0, 0);

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

From source file:buildcraft.factory.RenderTank.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {

    TileTank tank = ((TileTank) tileentity);

    LiquidStack liquid = tank.tank.getLiquid();

    if (liquid == null || liquid.amount <= 0 || liquid.itemID <= 0)
        return;/*from  w  ww  . j av a 2 s. c o m*/

    int[] displayList = getDisplayLists(liquid.itemID, liquid.itemMeta, tileentity.worldObj);

    GL11.glPushMatrix();
    GL11.glDisable(2896 /* GL_LIGHTING */);

    Object obj = null;

    if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null)
        obj = Block.blocksList[liquid.itemID];
    else
        obj = Item.itemsList[liquid.itemID];

    if (obj instanceof ITextureProvider)
        MinecraftForgeClient.bindTexture(((ITextureProvider) obj).getTextureFile());
    else
        MinecraftForgeClient.bindTexture("/terrain.png");

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

    GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.tank.getCapacity())
            * (displayStages - 1))]);

    GL11.glEnable(2896 /* GL_LIGHTING */);
    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  . jav a2  s.c  o 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 a  v a2s.c  o  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.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  w w. j av  a  2s .c o 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();//  w  w w .j  a  v a 2  s.c  o 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) (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.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 w  w  . j a v  a 2 s.  co 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 ww.  j av  a2s . 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:cn.lambdalib.util.deprecated.Mesh.java

License:MIT License

public void draw(Material mat) {
    if (doesBuffer) {
        if (listID == -1) {
            redraw(mat, true);/*from  w  ww .j  av  a 2 s.c  om*/
        } else
            GL11.glCallList(listID);
    } else {
        redraw(mat, true);
    }
}

From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java

License:Open Source License

/**
 * Draw the given display list.
 */
public void renderDisplayList(final int displayListID) {
    GL11.glCallList(displayListID);
}