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:buildcraft.silicon.render.RenderLaserBlock.java

License:Minecraft Mod Public

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

    if (laser != null) {
        GL11.glPushMatrix();/*w  w w  .j  a  v a  2 s .c  o m*/
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        GL11.glPushMatrix();
        RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser.laser,
                laser.getTexture());
        GL11.glPopMatrix();

        //GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}

From source file:buildcraft.silicon.render.RenderLaserTile.java

License:Minecraft Mod Public

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

    if (laser != null) {
        GL11.glPushMatrix();/*from  www. j ava2s .c  o  m*/
        GL11.glTranslated(x, y, z);
        GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);

        GL11.glPushMatrix();
        RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser.laser,
                laser.getTexture());
        GL11.glPopMatrix();

        GL11.glPopMatrix();
    }
}

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

License:Minecraft Mod Public

private static void renderWire(TileGenericPipe pipe, double x, double y, double z) {
    PipeWireKey key = new PipeWireKey(pipe.renderState);

    RenderHelper.disableStandardItemLighting();
    TileEntityRendererDispatcher.instance.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    GL11.glPushMatrix();//from w  w  w. j ava  2 s  . c o m
    GL11.glTranslated(x, y, z);

    PipeModelCacheWire.cacheAll.renderDisplayList(key);
    GL11.glPopMatrix();

    RenderHelper.enableStandardItemLighting();
}

From source file:buildcraftAdditions.client.models.BackPackModel.java

License:GNU General Public License

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(TEXTURE);
    GL11.glPushMatrix();/*from   w  ww  .j  av a2 s. c  o m*/
    GL11.glTranslatef(this.shape38_2.offsetX, this.shape38_2.offsetY, this.shape38_2.offsetZ);
    GL11.glTranslatef(this.shape38_2.rotationPointX * f5, this.shape38_2.rotationPointY * f5,
            this.shape38_2.rotationPointZ * f5);
    GL11.glScaled(0.9D, 1.0D, 1.0D);
    GL11.glTranslatef(-this.shape38_2.offsetX, -this.shape38_2.offsetY, -this.shape38_2.offsetZ);
    GL11.glTranslatef(-this.shape38_2.rotationPointX * f5, -this.shape38_2.rotationPointY * f5,
            -this.shape38_2.rotationPointZ * f5);
    this.shape38_2.render(f5);
    GL11.glPopMatrix();
    this.shape38_1.render(f5);
    this.shape38_6.render(f5);
    this.shape21_2.render(f5);
    this.handleTopRight.render(f5);
    this.shape38_5.render(f5);
    this.shape11_6.render(f5);
    this.shape49.render(f5);
    this.shape22.render(f5);
    this.shape21.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape21_1.offsetX, this.shape21_1.offsetY, this.shape21_1.offsetZ);
    GL11.glTranslatef(this.shape21_1.rotationPointX * f5, this.shape21_1.rotationPointY * f5,
            this.shape21_1.rotationPointZ * f5);
    GL11.glScaled(0.7D, 1.0D, 1.0D);
    GL11.glTranslatef(-this.shape21_1.offsetX, -this.shape21_1.offsetY, -this.shape21_1.offsetZ);
    GL11.glTranslatef(-this.shape21_1.rotationPointX * f5, -this.shape21_1.rotationPointY * f5,
            -this.shape21_1.rotationPointZ * f5);
    this.shape21_1.render(f5);
    GL11.glPopMatrix();
    this.shape38_4.render(f5);
    this.shape49_2.render(f5);
    this.shape11_1.render(f5);
    this.shape11_4.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape38.offsetX, this.shape38.offsetY, this.shape38.offsetZ);
    GL11.glTranslatef(this.shape38.rotationPointX * f5, this.shape38.rotationPointY * f5,
            this.shape38.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.7D, 1.0D);
    GL11.glTranslatef(-this.shape38.offsetX, -this.shape38.offsetY, -this.shape38.offsetZ);
    GL11.glTranslatef(-this.shape38.rotationPointX * f5, -this.shape38.rotationPointY * f5,
            -this.shape38.rotationPointZ * f5);
    this.shape38.render(f5);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape22_1.offsetX, this.shape22_1.offsetY, this.shape22_1.offsetZ);
    GL11.glTranslatef(this.shape22_1.rotationPointX * f5, this.shape22_1.rotationPointY * f5,
            this.shape22_1.rotationPointZ * f5);
    GL11.glScaled(1.0D, 1.3D, 1.0D);
    GL11.glTranslatef(-this.shape22_1.offsetX, -this.shape22_1.offsetY, -this.shape22_1.offsetZ);
    GL11.glTranslatef(-this.shape22_1.rotationPointX * f5, -this.shape22_1.rotationPointY * f5,
            -this.shape22_1.rotationPointZ * f5);
    this.shape22_1.render(f5);
    GL11.glPopMatrix();
    this.handleTopLeft.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape21_4.offsetX, this.shape21_4.offsetY, this.shape21_4.offsetZ);
    GL11.glTranslatef(this.shape21_4.rotationPointX * f5, this.shape21_4.rotationPointY * f5,
            this.shape21_4.rotationPointZ * f5);
    GL11.glScaled(0.9D, 1.0D, 1.0D);
    GL11.glTranslatef(-this.shape21_4.offsetX, -this.shape21_4.offsetY, -this.shape21_4.offsetZ);
    GL11.glTranslatef(-this.shape21_4.rotationPointX * f5, -this.shape21_4.rotationPointY * f5,
            -this.shape21_4.rotationPointZ * f5);
    this.shape21_4.render(f5);
    GL11.glPopMatrix();
    this.shape11_2.render(f5);
    this.shape11_9.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape25.offsetX, this.shape25.offsetY, this.shape25.offsetZ);
    GL11.glTranslatef(this.shape25.rotationPointX * f5, this.shape25.rotationPointY * f5,
            this.shape25.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.7D, 1.0D);
    GL11.glTranslatef(-this.shape25.offsetX, -this.shape25.offsetY, -this.shape25.offsetZ);
    GL11.glTranslatef(-this.shape25.rotationPointX * f5, -this.shape25.rotationPointY * f5,
            -this.shape25.rotationPointZ * f5);
    this.shape25.render(f5);
    GL11.glPopMatrix();
    this.shape11_3.render(f5);
    this.shape11_8.render(f5);
    this.shape11.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape49_1.offsetX, this.shape49_1.offsetY, this.shape49_1.offsetZ);
    GL11.glTranslatef(this.shape49_1.rotationPointX * f5, this.shape49_1.rotationPointY * f5,
            this.shape49_1.rotationPointZ * f5);
    GL11.glScaled(1.0D, 0.6D, 1.0D);
    GL11.glTranslatef(-this.shape49_1.offsetX, -this.shape49_1.offsetY, -this.shape49_1.offsetZ);
    GL11.glTranslatef(-this.shape49_1.rotationPointX * f5, -this.shape49_1.rotationPointY * f5,
            -this.shape49_1.rotationPointZ * f5);
    this.shape49_1.render(f5);
    GL11.glPopMatrix();
    GL11.glPushMatrix();
    GL11.glTranslatef(this.shape21_3.offsetX, this.shape21_3.offsetY, this.shape21_3.offsetZ);
    GL11.glTranslatef(this.shape21_3.rotationPointX * f5, this.shape21_3.rotationPointY * f5,
            this.shape21_3.rotationPointZ * f5);
    GL11.glScaled(0.7D, 1.0D, 1.0D);
    GL11.glTranslatef(-this.shape21_3.offsetX, -this.shape21_3.offsetY, -this.shape21_3.offsetZ);
    GL11.glTranslatef(-this.shape21_3.rotationPointX * f5, -this.shape21_3.rotationPointY * f5,
            -this.shape21_3.rotationPointZ * f5);
    this.shape21_3.render(f5);
    GL11.glPopMatrix();
    this.shape11_5.render(f5);
    this.shape38_3.render(f5);
    this.shape11_7.render(f5);
    if (entity != null && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        ItemStack bStack = player.getCurrentArmor(2);
        ItemKineticBackpack backpack = (ItemKineticBackpack) bStack.getItem();
        if (backpack.getInstalledCapsule(bStack, 0) != 0) {
            GL11.glPushMatrix();
            GL11.glTranslated(0.14, -1.35, 0.25);
            GL11.glScaled(1.5, 1.5, 1.5);
            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();
            GL11.glTranslated(-0.14, -1.35, 0.25);
            GL11.glScaled(1.5, 1.5, 1.5);
            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();
            GL11.glTranslated(0.14, -1.15, 0.25);
            GL11.glScaled(1.5, 1.5, 1.5);
            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();
            GL11.glTranslated(-0.14, -1.15, 0.25);
            GL11.glScaled(1.5, 1.5, 1.5);
            ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 3));
            GL11.glPopMatrix();
        }
    }
}

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

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemBucketBCA))
        return;/*from  www  .  j a v  a 2  s.  co m*/

    ItemBucketBCA bucket = (ItemBucketBCA) item.getItem();
    Fluid fluid = null;
    boolean gaseous = false;

    if (bucket.getFluid() != null) {
        fluid = bucket.getFluid().getFluid();
        if (fluid != null && (fluid.isGaseous() || fluid.getDensity() < 0))
            gaseous = true;
    }

    IIcon overlay = bucket.getOverlay();
    IIcon bucketIcon = Items.bucket.getIconFromDamage(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glTranslated(-0.5, -0.9, 0);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.075, 0.475, 0);
            GL11.glScaled(0.85, 0.85, 0.85);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    }

    if (fluid != null) {
        Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);
        renderMask(overlay, fluid.getIcon(), type, gaseous);
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);

    if (!type.equals(ItemRenderType.INVENTORY)) {
        if (gaseous)
            ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMaxU(), bucketIcon.getMinV(),
                    bucketIcon.getMinU(), bucketIcon.getMaxV(), bucketIcon.getIconWidth(),
                    bucketIcon.getIconHeight(), 0.0625F);
        else
            ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMinU(), bucketIcon.getMaxV(),
                    bucketIcon.getMaxU(), bucketIcon.getMinV(), bucketIcon.getIconWidth(),
                    bucketIcon.getIconHeight(), 0.0625F);
    } else
        renderIcon(bucketIcon, 0, gaseous);

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    IIcon overlay = canister.overlay;//from   w w w . java2  s .  c o m
    IIcon cannister = canister.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);
    }

    if (item.stackTagCompound != null && item.getTagCompound().hasKey("Fluid")) {
        Fluid fluid = FluidRegistry
                .getFluid(item.stackTagCompound.getCompoundTag("Fluid").getString("FluidName"));
        if (fluid != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
            renderMask(overlay, fluid.getIcon(), type);
        }
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);

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

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

From source file:buildcraftAdditions.client.render.entities.EntityLaserShotRenderer.java

License:GNU General Public License

private void doRender(EntityLaserShot entity, double x, double y, double z, float rotation,
        float partialTicks) {
    bindEntityTexture(entity);//from   w ww . j  a v  a2  s. c om
    GL11.glPushMatrix();
    float strength = entity.getStrength();
    if (strength >= 1)
        GL11.glColor3f(1, 0, 0);
    else if (strength > 0.75)
        GL11.glColor3f(0.75F, 0, 0.25F);
    else if (strength > 0.6)
        GL11.glColor3f(0.5F, 0, 0.5F);
    else if (strength > 0.35)
        GL11.glColor3f(0.25F, 0, 0.75F);
    else
        GL11.glColor3f(0, 0, 1);
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90,
            0, 1, 0);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks,
            0, 0, 1);
    Tessellator t = Tessellator.instance;
    double d1 = 0;
    double d2 = 0.5;
    double d3 = 0 / 32D;
    double d4 = 5 / 32D;
    double d5 = 0.05625;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    float f1 = entity.throwableShake - partialTicks;
    if (f1 > 0) {
        float f2 = -MathHelper.sin(f1 * 3) * f1;
        GL11.glRotatef(f2, 0, 0, 1);
    }

    GL11.glRotatef(45, 1, 0, 0);
    GL11.glScaled(d5, d5, d5);
    GL11.glTranslatef(-4, 0, 0);
    for (int i = 0; i < 4; i++) {
        GL11.glRotatef(90, 1, 0, 0);
        GL11.glNormal3d(0, 0, d5);
        t.startDrawingQuads();
        t.addVertexWithUV(-8, -2, 0, d1, d3);
        t.addVertexWithUV(8, -2, 0, d2, d3);
        t.addVertexWithUV(8, 2, 0, d2, d4);
        t.addVertexWithUV(-8, 2, 0, d1, d4);
        t.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

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

License:GNU General Public License

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

    GL11.glPushMatrix();/*from  w  w  w .  j  ava2 s.  co  m*/
    switch (type) {
    case EQUIPPED:
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-0.75, -0.5, 0);
        break;
    case EQUIPPED_FIRST_PERSON:
        GL11.glTranslated(1, .5, 0);
        GL11.glRotated(270, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glRotated(180, 0, 1, 0);
        break;
    case INVENTORY:
        GL11.glRotated(180, 0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glTranslated(0, -.25, 0);
    }
    BackPackModel.INSTANCE2.render(null, 0, 0, 0, 0, 0, 0.06f);

    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();/*w  w w . j  a  v  a 2  s .  c o  m*/
    switch (type) {
    case ENTITY:
        GL11.glTranslated(0, 1, 0);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glRotated(90, 0, 1, 0);
        break;
    case EQUIPPED:
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-0.75, 0, 0);
        GL11.glTranslated(0, -1.5, 0);
        break;
    case EQUIPPED_FIRST_PERSON:
        GL11.glTranslated(1, 1.5, 0);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
        break;
    case INVENTORY:
        GL11.glRotated(180, 1, 0, 0);
        GL11.glTranslated(0, -1, 0);
        break;
    default:
        break;
    }
    ModelBackpackStand.INSTANCE2.render(null, 0, 0, 0, 0, 0, 0.0625F);

    GL11.glPopMatrix();
}

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

License:GNU General Public License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemCanister))
        return;/*from w w w.  j  av a 2 s.  c  om*/

    ItemCanister canister = (ItemCanister) item.getItem();

    IIcon overlay = canister.getOverlay();
    IIcon canisterIcon = canister.getIconFromDamage(0);

    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    if (type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glTranslated(-1, -1, 0);
    } else if (type.equals(ItemRenderType.ENTITY)) {
        GL11.glRotated(180, 0, 0, 1);
        GL11.glRotated(90, 0, 1, 0);
        GL11.glTranslated(-0.5, -0.9, 0);
        if (item.isOnItemFrame()) {
            GL11.glTranslated(0.075, 0.475, 0);
            GL11.glScaled(0.85, 0.85, 0.85);
        }
    } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslated(1, 1, 0);
        GL11.glRotated(180, 0, 0, 1);
    }

    FluidStack fluid = Utils.getFluidStackFromItemStack(item);
    if (fluid != null) {
        Fluid f = fluid.getFluid();
        if (f != null) {
            Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);
            renderMask(overlay, f.getIcon(), type);
        }
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET);

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

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glPopMatrix();
}