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:com.teambrmodding.luxetumbra.core.client.elements.Element.java

License:Creative Commons License

/**
 * Local copy of drawHoveringText using parent as base
 * @param toolTip The toolTip//w  w  w  .  j  a  va 2 s  .  c  om
 * @param mouseX The mouse X
 * @param mouseY The mouse Y
 * @param parent The parent GUI
 * @param font The fontRenderObj
 */
protected void drawHoveringText(ArrayList<String> toolTip, int mouseX, int mouseY, GuiScreen parent,
        FontRenderer font) {
    if (!toolTip.isEmpty()) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.0, 0.0, 5);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        int k = 0;
        for (String s : toolTip) {
            int l = font.getStringWidth(s);
            if (l > k) {
                k = l;
            }
        }
        int j2 = mouseX + 12;
        int k2 = mouseY - 12;
        int i1 = 8;
        if (toolTip.size() > 1) {
            i1 += 2 + (toolTip.size() - 1) * 10;
        }
        if (j2 + k > parent.width) {
            j2 -= 28 + k;
        }
        if (k2 + i1 + 6 > parent.height) {
            k2 = this.getHeight() - i1 - 6;
        }
        this.zLevel = 300.0F;
        int j1 = -267386864;
        this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1);
        this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1);
        this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1);
        this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1);
        this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1);
        int k1 = 1347420415;
        int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
        this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1);
        this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1);
        this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1);
        this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1);

        for (int i2 = 0; i2 < toolTip.size(); i2++) {
            String s1 = toolTip.get(i2);
            font.drawStringWithShadow(s1, j2, k2, -1);
            if (i2 == 0)
                k2 += 2;
            k2 += 10;
        }

        this.zLevel = 0.0F;
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        RenderHelper.enableStandardItemLighting();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}

From source file:com.teambrmodding.neotech.client.renderers.tiles.TileRenderHelper.java

License:Creative Commons License

protected void alignRendering(EnumFacing side, EnumFacing orientation, LocationDouble position) {
    GL11.glTranslated(position.x + 0.5F, position.y + 0.5F, position.z + 0.5F); // We align the rendering on the center of the block
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(this.getRotationYForSide(side, orientation), 0.0F, 1.0F, 0.0F); // We rotate it so it face the right face
    GL11.glRotatef(this.getRotationXForSide(side), 1.0F, 0.0F, 0.0F);
    GL11.glTranslated(-0.5F, -0.5F, -0.5f);
}

From source file:com.teambrmodding.neotech.client.renderers.tiles.TileRenderHelper.java

License:Creative Commons License

protected void moveRendering(float size, double posX, double posY, double posz) {
    GL11.glTranslated(0, 0, posz);
    GL11.glScalef(scale, scale, -0.0001f); // We flatten the rendering and scale it to the right size
    GL11.glTranslated(posX, posY, 0); // Finally, we translate the icon itself to the correct position
    GL11.glScalef(size, size, 1.0f);/*from  w  ww.  j av  a  2 s .c o m*/
}

From source file:de.mineformers.powergrid.client.renderer.tileentity.TileCableRenderer.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTick) {
    TileCable tile = (TileCable) tileentity;
    Tessellator tess = Tessellator.instance;

    this.bindTexture(TextureMap.locationBlocksTexture);
    EnumSet<ForgeDirection> cons = tile.getConnections();

    this.bindBlock();

    GL11.glPushMatrix();/*from   w  ww  .  j av a 2 s .co m*/
    GL11.glDisable(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);

    drawBase(tess, cons);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    if (cons.contains(ForgeDirection.UP)) {
        drawConnection(tess);
    }
    if (cons.contains(ForgeDirection.DOWN)) {
        GL11.glRotatef(180, 1, 0, 0);
        drawConnection(tess);
        GL11.glRotatef(-180, 1, 0, 0);
    }
    if (cons.contains(ForgeDirection.EAST)) {
        GL11.glRotatef(-90, 0, 0, 1);
        drawConnection(tess);
        GL11.glRotatef(90, 0, 0, 1);
    }
    if (cons.contains(ForgeDirection.WEST)) {
        GL11.glRotatef(90, 0, 0, 1);
        drawConnection(tess);
        GL11.glRotatef(-90, 0, 0, 1);
    }

    if (cons.contains(ForgeDirection.NORTH)) {
        GL11.glRotatef(-90, 1, 0, 0);
        drawConnection(tess);
        GL11.glRotatef(90, 1, 0, 0);
    }
    if (cons.contains(ForgeDirection.SOUTH)) {
        GL11.glRotatef(90, 1, 0, 0);
        drawConnection(tess);
        GL11.glRotatef(-90, 1, 0, 0);
    }

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

From source file:de.mineformers.robots.client.renderer.tileentity.TileFactoryControllerRenderer.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTicks) {
    if (((TileFactoryController) tileentity).isValidMultiblock()) {
        GL11.glPushMatrix();/*from  w  w  w .  jav a2 s.  c o m*/
        int i = 15728880;

        int j = i % 65536;
        int k = i / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
        GL11.glTranslated(x + 0.5F, y + 0.65F, z + 0.5f);
        switch (((TileFactoryController) tileentity).getOrientation()) {
        case WEST:
            GL11.glRotatef(90, 0, 1, 0);
            break;
        case EAST:
            GL11.glRotatef(-90, 0, 1, 0);
            break;
        case SOUTH:
            GL11.glRotatef(180, 0, 1, 0);
            break;
        }
        GL11.glTranslatef(0, 0, -0.47F);
        GL11.glScalef(0.3F, 0.3F, 0.3F);
        GL11.glRotatef(180, 1, 0, 0);
        GL11.glRotatef(180, 0, 1, 0);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glColor4f(255F, 255F, 255F, 255F);
        this.bindTexture(robotTexture);
        robot.justRender();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
}

From source file:de.sanandrew.mods.turretmod.client.gui.tcu.GuiTcuInfo.java

License:Creative Commons License

@Override
public void drawScreenPostBkg(int mouseX, int mouseY, float partTicks) {
    this.mc.renderEngine.bindTexture(Textures.GUI_TCU_INFO.getResource());

    GL11.glColor3f(1.0F, 1.0F, 1.0F);/*from w w  w  .  ja  v  a 2 s. com*/
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);

    if (this.specOwnerHead >= 0) {
        this.drawTexturedModalRect(this.guiLeft + 7, this.guiTop + 95, this.xSize, this.specOwnerHead * 8, 10,
                8);
    }

    String value = this.myTurret.hasCustomNameTag() ? this.myTurret.getCustomNameTag() : "-n/a-";
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 23, 0x000000);

    value = String.format("%.1f / %.1f HP", this.myTurret.getHealth(), this.myTurret.getMaxHealth());
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 35, 0x000000);

    value = String.format("%d", this.myTurret.getAmmo());

    if (this.myTurret.getAmmoType() != null) {
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
        GuiUtils.drawGuiStack(this.myTurret.getAmmoType().getTypeItem(), this.guiLeft + 21, this.guiTop + 49);
        GL11.glTranslated(0.0D, 0.0D, 300.0D);
        this.frAmmoItem.drawStringWithShadow(value, this.guiLeft + 38 - this.frAmmoItem.getStringWidth(value),
                this.guiTop + 58, 0xFFFFFFFF);
        GL11.glTranslated(0.0D, 0.0D, -300.0D);
    }
    this.zLevel = 0.0F;
    value = this.myTurret.getAmmoType() != null ? this.myTurret.getAmmoType().getTypeItem().getDisplayName()
            : "-n/a-";
    this.fontRendererObj.drawString(value, this.guiLeft + 42, this.guiTop + 48, 0x000000);

    value = this.myTurret.getTargetHandler().hasTarget(this.myTurret)
            ? SAPUtils.translatePreFormat("entity.%s.name",
                    this.myTurret.getTargetHandler().getTargetName(this.myTurret))
            : "-n/a-";
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 71, 0x000000);

    value = this.myTurret.getOwnerName();
    this.fontRendererObj.drawString(value, this.guiLeft + 20, this.guiTop + 95, 0x000000);
}

From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java

License:Creative Commons License

private static void setupTooltipRenderer(Minecraft mc, TileEntityItemTransmitter te, float partTicks) {
    double playerPTX = mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * partTicks;
    double playerPTZ = mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * partTicks;
    Vec3 vecPos = Vec3.createVectorHelper(playerPTX - (te.xCoord + 0.5D), 0.0, playerPTZ - (te.zCoord + 0.5D));
    vecPos = vecPos.normalize();//from  ww w  .  j a v a2 s .c o  m
    double angle = Math.toDegrees(Math.atan2(vecPos.zCoord, vecPos.xCoord));

    GL11.glDepthMask(false);
    GL11.glRotated(90, 0.0F, 1.0F, 0.0F);
    GL11.glRotated(angle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslated(0.0F, -0.25F, 0.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    GL11.glColor4d(1.0D, 1.0D, 1.0D, 0.75D + (float) SAPUtils.RNG.nextGaussian() * 0.02F);
}

From source file:dynamicswordskills.client.RenderEntitySwordBeam.java

License:Open Source License

public void renderBeam(Entity entity, double x, double y, double z, float yaw, float partialTick) {
    GL11.glPushMatrix();/*from   w  w w . ja v  a  2 s .  c  om*/
    GL11.glTranslated(x, y, z);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glScalef(1.5F, 1.25F, 1.5F);
    bindTexture(texture);
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer renderer = tessellator.getWorldRenderer();
    GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    renderer.startDrawingQuads();
    renderer.setNormal(0.0F, 1.0F, 0.0F);
    renderer.addVertexWithUV(-0.5D, -0.25D, 0.0D, 0, 1);
    renderer.addVertexWithUV(0.5D, -0.25D, 0.0D, 1, 1);
    renderer.addVertexWithUV(0.5D, 0.75D, 0.0D, 1, 0);
    renderer.addVertexWithUV(-0.5D, 0.75D, 0.0D, 0, 0);
    tessellator.draw();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:fr.mcnanotech.kevin_68.nanotechmod.city.client.renderer.tileentity.TileEntityTextSpotLightRender.java

License:Creative Commons License

public void renderTileEntitySignAt(TileEntityTextSpotLight tileentity, double par2, double par4, double par6,
        float par8) {
    float f = tileentity.isActiveFloat();
    if (f > 0.0F) {
        GL11.glPushMatrix();// w  ww  .j a va 2  s.co m
        float f1 = 0.6666667F;
        float f2 = 0.0F;

        float d2 = (float) tileentity.getWorldObj().getTotalWorldTime() + par8;
        byte b1 = 1;
        double d3 = (double) d2 * 0.025D * (1.0D - (double) (b1 & 1) * 2.5D);
        int i1 = (tileentity.get(TileEntityTextSpotLight.REVERSEROTATION) == 1 ? -1 : 1);

        GL11.glTranslatef((float) par2 + 0.5F, (float) par4 + 0.75F * f1, (float) par6 + 0.5F);
        GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScaled(0.9D, 0.9D, 0.9D);
        if (tileentity.get(TileEntityTextSpotLight.ROTATE) == 0) {
            GL11.glRotated(d3 * 5 * tileentity.get(TileEntityTextSpotLight.ROTATIONSPEED) * i1, 0.0F, 1.0F,
                    0.0F);
        } else {
            GL11.glRotatef(tileentity.get(TileEntityTextSpotLight.ANGLE), 0.0F, 1.0F, 0.0F);
        }
        this.modelSign.signStick.showModel = false;

        this.bindTexture(field_110638_a);
        GL11.glPushMatrix();
        GL11.glScalef(f1, -f1, -f1);
        this.modelSign.renderSign();
        GL11.glPopMatrix();
        FontRenderer fontrenderer = this.func_147498_b();
        f2 = 0.016666668F * f1;
        GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
        GL11.glScalef(f2 * 5, -f2 * 5, f2 * 5);
        GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2);
        GL11.glDepthMask(false);

        GL11.glTranslated(0.0F, -tileentity.get(TileEntityTextSpotLight.HEIGHT), 0.0F);
        // GL11.glTranslated(0.0F, tileentity.getScale() / 5.0F, 0.0F);
        GL11.glScaled(1.0 + (1.0 * (tileentity.get(TileEntityTextSpotLight.SCALE) / 10)),
                1.0 + (1.0 * (tileentity.get(TileEntityTextSpotLight.SCALE) / 10)),
                1.0 + (1.0 * (tileentity.get(TileEntityTextSpotLight.SCALE) / 10)));

        String s = tileentity.signText;
        fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, -20,
                (tileentity.get(TileEntityTextSpotLight.RED) * 65536)
                        + (tileentity.get(TileEntityTextSpotLight.GREEN) * 256)
                        + tileentity.get(TileEntityTextSpotLight.BLUE));
        // GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
        // fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2,
        // -20, (tileentity.getRedValue() * 65536) +
        // (tileentity.getGreenValue() * 256) + tileentity.getBlueValue());

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

From source file:fr.wolf.addons.client.render.TESRCable.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale, int p_180535_9_) {
    GL11.glTranslated(x, y, z);
    GL11.glDisable(GL11.GL_LIGHTING);/*from   w w  w.  j  ava 2 s.co  m*/
    this.bindTexture(texture);
    {
        TileEntityCable cable = (TileEntityCable) te;
        if (!cable.onlyOpposite(cable.direction)) {
            this.renderCore((TileEntityCable) te);

            for (int i = 0; i < cable.direction.length; i++) {
                if (cable.direction[i] != null) {
                    this.renderDirectional(cable.direction[i]);
                }
            }
        } else {
            for (int i = 0; i < cable.direction.length; i++) {
                if (cable.direction[i] != null) {
                    this.renderStraight(cable.direction[i]);
                    break;
                }
            }
        }
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glTranslated(-x, -y, -z);
}