Example usage for org.lwjgl.opengl GL11 glTranslated

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

Introduction

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

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

Usage

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

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();// ww w  . j a v a2  s .  c om
    GL11.glRotated(180, 0, 0, 1);
    switch (type) {
    case EQUIPPED:
    case EQUIPPED_FIRST_PERSON:
        GL11.glTranslated(-0.5, -1.5, 0.5);
        break;
    case INVENTORY:
    case ENTITY:
        GL11.glTranslated(0, -1, 0);
        break;
    default:
        break;
    }
    model.render(0);

    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    IIcon overlayChainsaw = tool.overlayChainsaw;
    IIcon overlayDigger = tool.overlayDigger;
    IIcon overlayDrill = tool.overlayDrill;
    IIcon overlayHoe = tool.overlayHoe;/*  w w w . j  ava2  s  .  c  om*/
    IIcon toolIcon = tool.getIconFromDamage(0);

    GL11.glPushMatrix();
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
        GL11.glTranslated(-1.0D, -1.0D, 0.0D);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
        GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
        GL11.glTranslated(-0.5D, -0.9D, 0.0D);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.1D, 0.4D, 0.0D);
            GL11.glScaled(0.85D, 0.85D, 0.85D);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1.0D, 1.0D, 0.0D);
        GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D);
    }

    String lastUsedMode = "";
    if (item.stackTagCompound != null && item.stackTagCompound.hasKey("lastUsedMode"))
        lastUsedMode = item.stackTagCompound.getString("lastUsedMode");
    if (lastUsedMode.equals("axe")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayChainsaw, overlayChainsaw, type);
    }

    if (lastUsedMode.equals("shovel")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayDigger, overlayDigger, type);
    }

    if (lastUsedMode.equals("pickaxe")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayDrill, overlayDrill, type);
    }

    if (lastUsedMode.equals("hoe")) {
        Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
        renderMask(overlayHoe, overlayHoe, type);
    }

    Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);

    if (!type.equals(ItemRenderType.INVENTORY))
        ItemRenderer.renderItemIn2D(Tessellator.instance, toolIcon.getMinU(), toolIcon.getMaxV(),
                toolIcon.getMaxU(), toolIcon.getMinV(), toolIcon.getIconWidth(), toolIcon.getIconHeight(),
                0.0625F);
    else
        renderIcon(toolIcon, 0.0D);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    GL11.glPushMatrix();// w  w w .  j  a  v a  2s  .c  o m
    GL11.glTranslated(x, y, z);
    TileBaseDuster duster = (TileBaseDuster) entity;
    ItemStack stack = duster.getStackInSlot(0);
    EntityItem item;
    if (stack != null) {
        item = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, stack);
        item.hoverStart = 0;
        RenderManager.instance.renderEntityWithPosYaw(item, 0.5, 1.05, 0.5, 0, 0);
    }
    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    GL11.glPushMatrix();//w w  w .  java  2s  .c o m
    GL11.glTranslated(x, y, z);
    TileBaseDuster duster = (TileBaseDuster) entity;
    ItemStack stack = duster.getStackInSlot(0);
    EntityItem item;
    if (stack != null) {
        item = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, stack);
        item.hoverStart = 0;
        RenderManager.instance.renderEntityWithPosYaw(item, 0.5, 0.5, 0.5, 0, 0);
    }
    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    TileKEBT2 keb = (TileKEBT2) entity;// w  w  w.j a v  a 2s  .  c o m
    if (!keb.isMaster)
        return;
    bindTexture(side[keb.energyState]);
    RenderHelper.disableStandardItemLighting();
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    //NORTH
    tessellator.addVertexWithUV(0, 0, -1, 1, 1);
    tessellator.addVertexWithUV(0, 2, -1, 1, 0);
    tessellator.addVertexWithUV(2, 2, -1, 0, 0);
    tessellator.addVertexWithUV(2, 0, -1, 0, 1);

    //EAST
    tessellator.addVertexWithUV(2, 0, -1, 0, 1);
    tessellator.addVertexWithUV(2, 2, -1, 0, 0);
    tessellator.addVertexWithUV(2, 2, 1, 1, 0);
    tessellator.addVertexWithUV(2, 0, 1, 1, 1);

    //SOUTH
    tessellator.addVertexWithUV(2, 0, 1, 0, 1);
    tessellator.addVertexWithUV(2, 2, 1, 0, 0);
    tessellator.addVertexWithUV(0, 2, 1, 1, 0);
    tessellator.addVertexWithUV(0, 0, 1, 1, 1);

    //WEST
    tessellator.addVertexWithUV(0, 0, 1, 1, 1);
    tessellator.addVertexWithUV(0, 2, 1, 1, 0);
    tessellator.addVertexWithUV(0, 2, -1, 0, 0);
    tessellator.addVertexWithUV(0, 0, -1, 0, 1);
    tessellator.draw();

    bindTexture(topAndBottom);
    tessellator.startDrawingQuads();

    //BOTTOM
    tessellator.addVertexWithUV(2, 0, -1, 1, 1);
    tessellator.addVertexWithUV(2, 0, 1, 1, 0);
    tessellator.addVertexWithUV(0, 0, 1, 0, 0);
    tessellator.addVertexWithUV(0, 0, -1, 0, 1);

    //TOP
    tessellator.addVertexWithUV(0, 2, -1, 0, 1);
    tessellator.addVertexWithUV(0, 2, 1, 0, 0);
    tessellator.addVertexWithUV(2, 2, 1, 1, 0);
    tessellator.addVertexWithUV(2, 2, -1, 1, 1);

    tessellator.draw();
    GL11.glPopMatrix();
    RenderHelper.enableStandardItemLighting();
}

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

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    TileKEBT3 keb = (TileKEBT3) entity;// ww  w .jav a 2 s .  com
    if (!keb.isMaster())
        return;
    bindTexture(sides[keb.energyState]);
    RenderHelper.disableStandardItemLighting();
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    //NORTH
    tessellator.addVertexWithUV(-1, -1, -1, 1, 1);
    tessellator.addVertexWithUV(-1, 2, -1, 1, 0);
    tessellator.addVertexWithUV(2, 2, -1, 0, 0);
    tessellator.addVertexWithUV(2, -1, -1, 0, 1);

    //EAST
    tessellator.addVertexWithUV(2, -1, -1, 0, 1);
    tessellator.addVertexWithUV(2, 2, -1, 0, 0);
    tessellator.addVertexWithUV(2, 2, 2, 1, 0);
    tessellator.addVertexWithUV(2, -1, 2, 1, 1);

    //SOUTH
    tessellator.addVertexWithUV(2, -1, 2, 0, 1);
    tessellator.addVertexWithUV(2, 2, 2, 0, 0);
    tessellator.addVertexWithUV(-1, 2, 2, 1, 0);
    tessellator.addVertexWithUV(-1, -1, 2, 1, 1);

    //WEST
    tessellator.addVertexWithUV(-1, -1, 2, 1, 1);
    tessellator.addVertexWithUV(-1, 2, 2, 1, 0);
    tessellator.addVertexWithUV(-1, 2, -1, 0, 0);
    tessellator.addVertexWithUV(-1, -1, -1, 0, 1);
    tessellator.draw();

    bindTexture(topAndBottom);
    tessellator.startDrawingQuads();

    //BOTTOM
    tessellator.addVertexWithUV(2, -1, -1, 1, 1);
    tessellator.addVertexWithUV(2, -1, 2, 1, 0);
    tessellator.addVertexWithUV(-1, -1, 2, 0, 0);
    tessellator.addVertexWithUV(-1, -1, -1, 0, 1);

    //TOP
    tessellator.addVertexWithUV(-1, 2, -1, 0, 1);
    tessellator.addVertexWithUV(-1, 2, 2, 0, 0);
    tessellator.addVertexWithUV(2, 2, 2, 1, 0);
    tessellator.addVertexWithUV(2, 2, -1, 1, 1);

    tessellator.draw();
    GL11.glPopMatrix();
    RenderHelper.enableStandardItemLighting();
}

From source file:buildcraftAdditions.client.render.tileentities.RendererBackPackStand.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    if (entity == null || !(entity instanceof TileBackpackStand))
        return;//from w  w w.  ja  v a 2  s.  com
    int orientation = entity.getWorldObj().getBlockMetadata(entity.xCoord, entity.yCoord, entity.zCoord);
    int angle;
    switch (orientation) {
    case 2:
        angle = 0;
        break;
    case 3:
        angle = 180;
        break;
    case 4:
        angle = 90;
        break;
    case 5:
        angle = -90;
        break;
    default:
        angle = 0;
    }
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 2.4, z + 0.5);
    GL11.glRotated(angle, 0, 1, 0);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glScaled(10, 10, 10);
    ModelBackpackStand.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.01f);
    GL11.glPopMatrix();

    TileBackpackStand stand = (TileBackpackStand) entity;
    if (stand.inventory.getStackInSlot(0) == null)
        return;
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 1.4, z + 0.5);
    GL11.glRotated(angle, 0, 1, 0);
    GL11.glRotated(180, 1, 0, 0);
    BackPackModel.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.1F);
    GL11.glPopMatrix();

    ItemStack bStack = stand.inventory.getStackInSlot(0);
    ItemKineticBackpack backpack = (ItemKineticBackpack) bStack.getItem();
    if (backpack.getInstalledCapsule(bStack, 0) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.7, y + 3.15, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.3, y + 3.15, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.07, y + 3.15, z + 0.3);
            break;
        case 5:
            GL11.glTranslated(x + 0.92, y + 3.15, z + 0.71);
            break;
        }
        GL11.glScaled(2, 2, 2);
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 0));
        GL11.glPopMatrix();
    }
    if (backpack.getInstalledCapsule(bStack, 1) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.3, y + 3.15, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.7, y + 3.15, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.08, y + 3.15, z + 0.69);
            break;
        case 5:
            GL11.glTranslated(x + 0.93, y + 3.15, z + 0.3);
            break;
        }
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glScaled(2, 2, 2);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 1));
        GL11.glPopMatrix();
    }
    if (backpack.getInstalledCapsule(bStack, 2) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.7, y + 2.85, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.3, y + 2.85, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.07, y + 2.85, z + 0.3);
            break;
        case 5:
            GL11.glTranslated(x + 0.92, y + 2.85, z + 0.71);
            break;
        }

        GL11.glScaled(2, 2, 2);
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 2));
        GL11.glPopMatrix();
    }
    if (backpack.getInstalledCapsule(bStack, 3) != 0) {
        GL11.glPushMatrix();
        switch (orientation) {
        case 2:
            GL11.glTranslated(x + 0.3, y + 2.85, z + 0.07);
            break;
        case 3:
            GL11.glTranslated(x + 0.7, y + 2.85, z + 0.93);
            break;
        case 4:
            GL11.glTranslated(x + 0.07, y + 2.85, z + 0.71);
            break;
        case 5:
            GL11.glTranslated(x + 0.92, y + 2.85, z + 0.31);
            break;
        }
        GL11.glScaled(2, 2, 2);
        GL11.glRotated(angle, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 3));
        GL11.glPopMatrix();
    }
}

From source file:buildcraftAdditions.client.render.tileentities.RendererDuster.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fl) {
    if (tile != null && tile instanceof TileBaseDuster) {
        TileBaseDuster duster = (TileBaseDuster) tile;
        GL11.glPushMatrix();/*from  w  ww. j  a  v  a2  s  .c  o m*/
        GL11.glTranslated(x + .5, y + .5 + getYOffset(), z + .5);
        float angle = 0;
        switch (ForgeDirection.getOrientation(duster.getBlockMetadata())) {
        case NORTH:
            angle = 0;
            break;
        case SOUTH:
            angle = 180;
            break;
        case WEST:
            angle = 90;
            break;
        case EAST:
            angle = -90;
            break;
        default:
            break;
        }
        GL11.glRotatef(angle, 0, 1, 0);
        ItemStack stack = duster.getStackInSlot(0);
        if (stack != null && stack.getItem() != null && stack.stackSize > 0) {
            EntityItem item = new EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, 0, stack);
            item.hoverStart = 0;
            RenderManager.instance.renderEntityWithPosYaw(item, 0, 0, 0, 0, 0);
        }
        GL11.glPopMatrix();
    }
}

From source file:buildcraftAdditions.client.render.tileentities.RendererDusterKinetic.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float fl) {
    super.renderTileEntityAt(tile, x, y, z, fl);
    if (tile != null && tile instanceof TileKineticDuster) {
        TileKineticDuster duster = (TileKineticDuster) tile;
        GL11.glPushMatrix();/*from w w w.  ja  v  a  2s .  c o  m*/
        GL11.glTranslated(x + .5, y + 1.5, z + .5);
        GL11.glRotated(180, 1, 0, 0);
        model.render(duster.progressStage);
        GL11.glPopMatrix();
    }
}

From source file:buildcraftAdditions.client.render.tileentities.RendererKEBT2.java

License:GNU General Public License

@Override
public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) {
    TileKEBT2 keb = (TileKEBT2) entity;/*from w  w  w . j ava2s.  c  om*/
    if (!keb.isMaster())
        return;
    bindTexture(side[keb.energyState]);
    RenderHelper.disableStandardItemLighting();
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    //NORTH
    tessellator.addVertexWithUV(0, 0, -1, 1, 1);
    tessellator.addVertexWithUV(0, 2, -1, 1, 0);
    tessellator.addVertexWithUV(2, 2, -1, 0, 0);
    tessellator.addVertexWithUV(2, 0, -1, 0, 1);

    //EAST
    tessellator.addVertexWithUV(2, 0, -1, 0, 1);
    tessellator.addVertexWithUV(2, 2, -1, 0, 0);
    tessellator.addVertexWithUV(2, 2, 1, 1, 0);
    tessellator.addVertexWithUV(2, 0, 1, 1, 1);

    //SOUTH
    tessellator.addVertexWithUV(2, 0, 1, 0, 1);
    tessellator.addVertexWithUV(2, 2, 1, 0, 0);
    tessellator.addVertexWithUV(0, 2, 1, 1, 0);
    tessellator.addVertexWithUV(0, 0, 1, 1, 1);

    //WEST
    tessellator.addVertexWithUV(0, 0, 1, 1, 1);
    tessellator.addVertexWithUV(0, 2, 1, 1, 0);
    tessellator.addVertexWithUV(0, 2, -1, 0, 0);
    tessellator.addVertexWithUV(0, 0, -1, 0, 1);
    tessellator.draw();

    bindTexture(topAndBottom);
    tessellator.startDrawingQuads();

    //BOTTOM
    tessellator.addVertexWithUV(2, 0, -1, 1, 1);
    tessellator.addVertexWithUV(2, 0, 1, 1, 0);
    tessellator.addVertexWithUV(0, 0, 1, 0, 0);
    tessellator.addVertexWithUV(0, 0, -1, 0, 1);

    //TOP
    tessellator.addVertexWithUV(0, 2, -1, 0, 1);
    tessellator.addVertexWithUV(0, 2, 1, 0, 0);
    tessellator.addVertexWithUV(2, 2, 1, 1, 0);
    tessellator.addVertexWithUV(2, 2, -1, 1, 1);

    tessellator.draw();
    GL11.glPopMatrix();
    RenderHelper.enableStandardItemLighting();
}