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:net.mechanicalcat.pycode.obj.Model.java

License:Open Source License

public void render() {
    GL11.glCallList(this.glList);
}

From source file:net.minecraft.src.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);

    int liquidId = tank.getLiquidId();

    if (tank.getLiquidQuantity() == 0 || liquidId == 0)
        return;//from w ww  .  j  av  a  2s.  c o m

    int[] d = getDisplayLists(tank.getLiquidId(), tileentity.worldObj);

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

    Object o = null;

    if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null)
        o = Block.blocksList[liquidId];
    else
        o = Item.itemsList[liquidId];

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

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

    GL11.glCallList(d[(int) ((float) tank.getLiquidQuantity() / (float) (tank.getTankCapacity())
            * (displayStages - 1))]);

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

From source file:net.minecraft.src.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();/*  ww  w  .j  av  a 2s. 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)
        if (liq.getSide(i) > 0) {
            DisplayLiquidList d = getListFromBuffer(liq.side[i], pipe.worldObj);

            if (d == null)
                continue;

            int stage = (int) ((float) liq.getSide(i) / (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

    if (liq.getCenter() > 0) {
        DisplayLiquidList d = getListFromBuffer(liq.center, pipe.worldObj);

        if (d != null) {
            int stage = (int) ((float) liq.getCenter() / (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:net.quetzi.bluepower.compat.fmp.MultipartBPPart.java

License:Open Source License

@Override
public void renderDynamic(Vector3 pos, float frame, int pass) {

    getPart().renderDynamic(new net.quetzi.bluepower.api.vec.Vector3(pos.x, pos.y, pos.z), pass, frame);

    if (emptyStaticRender == -1) {
        emptyStaticRender = GL11.glGenLists(1);
        GL11.glNewList(emptyStaticRender, GL11.GL_COMPILE);
        GL11.glEndList();/*from ww  w .j av a  2 s . c om*/
    }
    if (staticRender0 == -1 || getPart().shouldReRender())
        reRenderStatic(new Vector3(0, 0, 0), 0);
    if (staticRender1 == -1 || getPart().shouldReRender())
        reRenderStatic(new Vector3(0, 0, 0), 1);
    if (getPart().shouldReRender())
        getPart().resetRenderUpdate();

    if (getPart().shouldRenderStaticOnPass(pass)) {
        GL11.glPushMatrix();
        {
            GL11.glTranslated(pos.x, pos.y, pos.z);
            if (pass == 0) {
                GL11.glCallList(staticRender0);
            } else {
                GL11.glCallList(staticRender1);
            }
        }
        GL11.glPopMatrix();
    }

}

From source file:net.shadowmage.ancientwarfare.core.model.ModelPiece.java

License:Open Source License

protected void renderPrimitives(float tw, float th) {
    if (!compiled) {
        compiled = true;//from  w w w.jav  a 2  s .  com
        if (displayList < 0) {
            displayList = GL11.glGenLists(1);
        }
        GL11.glNewList(displayList, GL11.GL_COMPILE);
        for (Primitive p : primitives) {
            p.render(tw, th);
        }
        GL11.glEndList();
        GL11.glCallList(displayList);
    } else {
        GL11.glCallList(displayList);
    }
}

From source file:net.smert.frameworkgl.opengl.helpers.DisplayListHelper.java

License:Apache License

public void call(int displayListID) {
    GL11.glCallList(displayListID);
}

From source file:ocelot.mods.qp2.client.RenderRefinery.java

License:Open Source License

private void render(TileRefineryPlus tile, double x, double y, double z) {
    FluidStack liquid1 = null, liquid2 = null, liquidResult = null;

    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = this.magnet[0];
    if (tile != null) {
        liquid1 = tile.src1;// w w  w .  j av  a 2  s.com
        liquid2 = tile.src2;
        liquidResult = tile.res;

        anim = tile.getAnimationStage();

        angle = 0;
        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 = this.magnet[0];
        } else if (tile.animationSpeed <= 2.5) {
            theMagnet = this.magnet[1];
        } else if (tile.animationSpeed <= 4.5) {
            theMagnet = this.magnet[2];
        } else {
            theMagnet = this.magnet[3];
        }
    }

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

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

    GL11.glRotatef(angle, 0, 1, 0);

    bindTexture(TEXTURE);

    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glTranslatef(-4F * pixel, 0, -4F * pixel);
    this.tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, 4F * pixel);

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

    GL11.glTranslatef(4F * pixel, 0, 0);
    this.tank.render(pixel);
    GL11.glTranslatef(-4F * pixel, 0, 0);
    GL11.glPopMatrix();

    float trans1, trans2;

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

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    if (tile != null) {
        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(-0.5F, -0.5F, -0.5F);
        GL11.glScalef(0.5F, 1, 0.5F);

        if (liquid1 != null && liquid1.amount > 0) {
            int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.worldObj, false);

            if (list1 != null) {
                bindTexture(FluidRenderer.getFluidSheet(liquid1));
                FluidRenderer.setColorForFluidStack(liquid1);
                GL11.glCallList(
                        list1[(int) (liquid1.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]);
            }
        }

        if (liquid2 != null && liquid2.amount > 0) {
            int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.worldObj, false);

            if (list2 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(0, 0, 1);
                bindTexture(FluidRenderer.getFluidSheet(liquid2));
                FluidRenderer.setColorForFluidStack(liquid2);
                GL11.glCallList(
                        list2[(int) (liquid2.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]);
                GL11.glPopMatrix();
            }
        }

        if (liquidResult != null && liquidResult.amount > 0) {
            int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.worldObj, false);

            if (list3 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(1, 0, 0.5F);
                bindTexture(FluidRenderer.getFluidSheet(liquidResult));
                FluidRenderer.setColorForFluidStack(liquidResult);
                GL11.glCallList(list3[(int) (liquidResult.amount / (float) tile.buf
                        * (FluidRenderer.DISPLAY_STAGES - 1))]);
                GL11.glPopMatrix();
            }
        }
        GL11.glPopAttrib();
    }

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

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Draws a single display list./*from  w w  w. ja  va 2  s  .co m*/
 * @param listID - The display list handler.
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void drawList(int listID) {
    GL11.glCallList(listID);
}

From source file:org.craftmania.blocks.CrossedBlockBrush.java

License:Apache License

@Override
public void render(LightBuffer lightBuffer) {
    if (_callList != 0) {
        _terrain.bind();// w  ww . ja va2 s. c  om

        float light = lightBuffer.get(1, 1, 1) / 30.001f;

        /* Texture 11,10 -> 11,15 */
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        // GL11.glDepthFunc(GL11.GL_ALWAYS);
        GL11.glPushMatrix();
        GL11.glTranslatef(_position.x() + 0.5f, _position.y() + 0.5f, _position.z() + 0.5f);
        GL11.glColor3f(light, light, light);

        GL11.glCallList(_callList);

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

From source file:org.craftmania.inventory.CraftingTableInventory.java

License:Apache License

@Override
public void renderInventory() {
    if (_inventoryDrawList == -1) {
        return;//from  w  ww .ja v  a 2  s  .c  o m
    }

    Configuration conf = Game.getInstance().getConfiguration();

    GL11.glPushMatrix();
    GL11.glTranslatef(conf.getWidth() / 2.0f, conf.getHeight() / 2.0f, 0.0f);

    _tex.bind();

    GL11.glCallList(_inventoryDrawList);
    GL11.glPopMatrix();

    for (int i = 0; i < _raster.getCellCount(); ++i) {
        GL11.glPushMatrix();
        ReadablePoint r = _raster.getCenterOfCell(i);
        GL11.glTranslatef(r.getX(), r.getY(), 0);
        if (Mouse.getX() < r.getX() + 16 && Mouse.getX() > r.getX() - 16 && Mouse.getY() < r.getY() + 16
                && Mouse.getY() > r.getY() - 16) {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.2f);
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glVertex2i(-16, -16);
            GL11.glVertex2i(+16, -16);
            GL11.glVertex2i(+16, +16);
            GL11.glVertex2i(-16, +16);
            GL11.glEnd();
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

        }

        InventoryPlace place = getInventoryPlace(i);
        if (place != null) {
            place.render();
        }
        GL11.glPopMatrix();
    }

    /* Draggin item */
    if (_dragging && _draggingItem != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(Mouse.getX(), Mouse.getY(), 0);
        _draggingItem.render();
        GL11.glPopMatrix();
    }
}