Example usage for org.lwjgl.opengl GL11 glTranslatef

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

Introduction

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

Prototype

public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a translation matrix along the x-, y- and z- axes.

Usage

From source file:ccm.burialservices.client.renderers.GraveRenderer.java

License:Open Source License

private void renderSign(double x, double y, double z, float tickTime, String[] signText, int meta,
        boolean renderingItem) {
    if (signText.length == 0)
        return;//from  ww w .  j av a2 s . c o  m
    int i = 0;
    for (String line : signText)
        if (!Strings.isNullOrEmpty(line)) {
            i++;
        }
    if (i == 0)
        return;

    GL11.glPushMatrix();
    float f1 = 0.6666667F;
    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.75F * f1, (float) z + 0.5F);
    float f2 = 0.0F;

    switch (meta) {
    case 0:
        break;
    case 1:
        f2 = 90f;
        break;
    case 2:
        f2 = 180f;
        break;
    case 3:
        f2 = -90f;

    }
    GL11.glTranslated(0, -0.3, 0);
    if (renderingItem)
        GL11.glTranslated(0, 0.03, 0);

    GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslated(0, -1.2, 0);

    GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
    GL11.glTranslatef(0f, 0.8F, 0.5f);
    MODEL_SIGN.signStick.showModel = false;

    this.bindTexture(SIGN_TEXTURE);
    GL11.glPushMatrix();
    GL11.glScalef(f1, -f1, -f1);
    MODEL_SIGN.renderSign();
    GL11.glPopMatrix();
    FontRenderer fontrenderer = this.getFontRenderer();
    f2 = 0.016666668F * f1;
    GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
    GL11.glScalef(f2, -f2, f2);
    GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2);
    GL11.glDepthMask(false);
    byte b0 = 0;

    for (int j = 0; j < signText.length; ++j) {
        GL11.glPushMatrix();
        String s = signText[j];
        int width = fontrenderer.getStringWidth(s);
        if (width > 95) {
            float f = 1f - ((width) * 0.0015f);
            GL11.glScalef(f, f, f);
        }
        fontrenderer.drawString(s, -width / 2, j * 10 - 20, b0);
        GL11.glPopMatrix();
    }

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

From source file:ccm.burialservices.client.renderers.GraveRenderer.java

License:Open Source License

private static void renderItemHolding(int i, int meta, ItemStack stack, double x, double y, double z,
        float tickTime) {
    Icon icon = stack.getItem().getIcon(stack, i);

    if (icon == null)
        return;//from  w  ww .j a  va2 s.c  o m

    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z); //Center to block

    switch (meta) {
    case 0:
        break;
    case 1:
        GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(-1, 0, 0);
        break;
    case 2:
        GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(-1, 0, -1);
        break;
    case 3:
        GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslated(0, 0, -1);
        break;
    }

    if (stack.getItem() instanceof ItemSword) {
        GL11.glTranslated(0.44, 0.1d, 1.85);
        GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
    } else {
        GL11.glTranslated(0.5, 0.1d, 0.5);
    }
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);

    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber()));
    Tessellator tessellator = Tessellator.instance;

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glTranslatef(0.65f, 0.6f, -0.1f); // Center on block
    GL11.glRotatef(135f, 0, 0, 1);

    ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
            icon.getIconWidth(), icon.getIconHeight(), 0.06F);

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

From source file:ccm.placeableTools.client.SwordSignGui.java

License:Open Source License

/**
 * Draws the screen and all the components in it.
 *//*from   w  w w.j ava2 s  . c  o  m*/
public void drawScreen(int par1, int par2, float par3) {
    this.drawDefaultBackground();
    this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 40, 16777215);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (this.width / 2), 0.0F, 50.0F);
    float f1 = 93.75F;
    GL11.glScalef(-f1, -f1, -f1);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
    Block block = this.te.getBlockType();

    if (block == Block.signPost) {
        float f2 = (float) (this.te.getBlockMetadata() * 360) / 16.0F;
        GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(0.0F, -1.0625F, 0.0F);
    } else {
        int k = this.te.getBlockMetadata();
        float f3 = 0.0F;

        if (k == 2) {
            f3 = 180.0F;
        }

        if (k == 4) {
            f3 = 90.0F;
        }

        if (k == 5) {
            f3 = -90.0F;
        }

        GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(0.0F, -1.0625F, 0.0F);
    }

    if (this.updateCounter / 6 % 2 == 0) {
        fakeSign.lineBeingEdited = editLine;
    }

    TileEntityRenderer.instance.renderTileEntityAt(this.fakeSign, -0.5D, -0.75D, -0.5D, 0.0F);
    GL11.glPopMatrix();
    super.drawScreen(par1, par2, par3);
}

From source file:ccm.placeableTools.client.ToolRenderer.java

License:Open Source License

private void renderSign(double x, double y, double z, float tickTime, int facing, String[] signText, int meta) {
    GL11.glPushMatrix();/*from w  ww . ja v a 2 s.  co m*/
    float f1 = 0.6666667F;
    float f2 = 0.0F;

    switch (facing) {
    case 0:
    case 8:
        f2 = -90f;
        break;
    case 1:
    case 7:
        f2 = 90f;
        break;
    case 2:
    case 5:
        f2 = 180f;
    }

    if (meta >= 2) {
        GL11.glTranslated(0, -1.2, 0);
    }

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.75F * f1, (float) z + 0.5F);
    GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);

    GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
    GL11.glTranslatef(0f, 0.8F, 0.5f);
    MODEL_SIGN.signStick.showModel = false;

    if (facing > 4) {
        if (meta >= 2)
            GL11.glTranslated(-0.6, 0, 0);
        //GL11.glTranslated(b ? -0.4 : -0.6, 0, 0);

        if (meta == 2 && facing == 7)
            GL11.glTranslated(1.2, 0, 0);
        else if (meta == 3 && facing == 8)
            GL11.glTranslated(1.2, 0, 0);
        else if (meta == 4 && facing == 6)
            GL11.glTranslated(1.2, 0, 0);
        else if (meta == 5 && facing == 5)
            GL11.glTranslated(1.2, 0, 0);
    }

    this.bindTexture(SIGN_TEXTURE);
    GL11.glPushMatrix();
    GL11.glScalef(f1, -f1, -f1);
    MODEL_SIGN.renderSign();
    GL11.glPopMatrix();
    FontRenderer fontrenderer = this.getFontRenderer();
    f2 = 0.016666668F * f1;
    GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
    GL11.glScalef(f2, -f2, f2);
    GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2);
    GL11.glDepthMask(false);
    byte b0 = 0;

    for (int j = 0; j < signText.length; ++j) {
        GL11.glPushMatrix();
        String s = signText[j];
        int width = fontrenderer.getStringWidth(s);
        if (width > 95) {
            float f = 1f - ((width) * 0.0015f);
            GL11.glScalef(f, f, f);
        }
        fontrenderer.drawString(s, -width / 2, j * 10 - signText.length * 5, b0);
        GL11.glPopMatrix();
    }

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

From source file:ccm.placeableTools.client.ToolRenderer.java

License:Open Source License

public static void doRenderPass(int i, int meta, ItemStack stack, double x, double y, double z) {
    Icon icon = stack.getItem().getIcon(stack, i);

    if (icon == null)
        return;/*  w ww  . j a v a 2  s  . com*/

    GL11.glPushMatrix();
    TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
    texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber()));
    Tessellator tessellator = Tessellator.instance;

    GL11.glTranslated(x, y, z); //Center to block
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glTranslatef(-0.5f, .5f, 0.5f); // Center on block

    if (stack.getItem() instanceof ItemSpade || stack.getItem() instanceof ItemHoe) {
        float shift = 0.3f;
        switch (ForgeDirection.values()[meta]) {
        case NORTH:
            GL11.glTranslatef(0, 0, -shift);
            GL11.glRotatef(15f, -0.5f, 0, 0);
            break;
        case SOUTH:
            GL11.glTranslatef(0, 0, shift);
            GL11.glRotatef(-15f, -0.5f, 0, 0);
            break;
        case EAST:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            GL11.glTranslatef(0, 0, shift);
            GL11.glRotatef(-15f, -0.5f, 0, 0);
            break;
        case WEST:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            GL11.glTranslatef(0, 0, -shift);
            GL11.glRotatef(15f, -0.5f, 0, 0);
            break;
        case DOWN:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            break;
        }
        GL11.glTranslatef(0, 0, -0.03f); //Icon depth of the shovel
        GL11.glRotatef(180f, 1, 0, 0);
    } else if (stack.getItem() instanceof ItemAxe || stack.getItem() instanceof ItemPickaxe) {
        float shift = 0.15f;
        switch (ForgeDirection.values()[meta]) {
        case NORTH:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, 1);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        case SOUTH:
            GL11.glRotatef(-90f, 0, 1, 0);
            GL11.glTranslatef(-1, 0, -1);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        case EAST:
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        case WEST:
            GL11.glRotatef(180f, 0, 1, 0);
            GL11.glTranslatef(-2, 0, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-10f, 0, 0, 1);
            break;
        }
        GL11.glTranslatef(0, 0, 0.03F);
    } else if (stack.getItem() instanceof ItemSword) {
        float shift = 0.15f;
        switch (ForgeDirection.values()[meta]) {
        case NORTH:
            GL11.glRotatef(90f, 0, 1, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            GL11.glTranslatef(-1, 0, 1);
            break;
        case SOUTH:
            GL11.glRotatef(-90f, 0, 1, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            GL11.glTranslatef(-1, 0, -1);
            break;
        case EAST:
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            GL11.glTranslatef(-1, 1, 0);
            break;
        case WEST:
            GL11.glRotatef(180f, 0, 1, 0);
            GL11.glTranslatef(-1, 1, 0);
            GL11.glTranslatef(shift, 0, 0);
            GL11.glRotatef(-90f, 0, 0, 1);
            break;
        case UP:
            GL11.glRotatef(180f, 1, 0, 0);
            GL11.glTranslatef(1, 0, 1);
            GL11.glRotatef(90f, 0, 1, 0);
            break;
        case DOWN:
            GL11.glRotatef(180f, 1, 0, 0);
            break;
        }
        GL11.glTranslatef(-0.05f, 0, 0.03F);
    }
    GL11.glRotatef(-45f, 0, 0, 1);
    GL11.glScalef(1.5f, 1.5f, 1.5f);
    ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
            icon.getIconWidth(), icon.getIconHeight(), 0.06F / 1.5f);

    if (stack.hasEffect(i)) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        texturemanager.bindTexture(RES_ITEM_GLINT);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

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

From source file:cd4017be.automation.render.TileEntityAntimatterBombRenderer.java

public void render(AntimatterBomb amBomb, double x, double y, double z, float par8) {
    GL11.glPushMatrix();//from   w w w.  j a v a 2 s.  c o  m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);

    int r = amBomb.getWorldObj().getBlockMetadata(amBomb.xCoord, amBomb.yCoord, amBomb.zCoord);
    float rotationYaw = r == 2 ? 0F : r == 5 ? 90F : r == 3 ? 180F : 270F;
    GL11.glRotatef(rotationYaw, 0F, -1F, 0F);

    FontRenderer txtR = manager.getFontRenderer();

    GL11.glTranslatef(0F, 0F, -0.51F);
    float f = 0.03125F;
    GL11.glScalef(-f, -f, f);
    String s;
    if (amBomb.timer >= 0) {
        s = (amBomb.timer) + "t";
    } else {
        s = Utils.formatNumber(amBomb.antimatter * 0.000000001D, 3, 0) + "g";
    }
    txtR.drawString(s, -txtR.getStringWidth(s) / 2, -4, 0xff0000);
    GL11.glPopMatrix();
}

From source file:chb.mods.mffs.client.TECapacitorRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
    if (tileEntity instanceof TileEntityCapacitor) {
        TileEntityCapacitor topview = (TileEntityCapacitor) tileEntity;
        GL11.glPushMatrix();//from ww w  .j a v a 2 s . co  m
        GL11.glPolygonOffset(-10, -10);
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        int side = topview.getSide();
        float dx = 1F / 16;
        float dz = 1F / 16;
        float displayWidth = 1 - 2F / 16;
        float displayHeight = 1 - 2F / 16;
        GL11.glTranslatef((float) x, (float) y, (float) z);
        switch (side) {
        case 1:

            break;
        case 0:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(180, 1, 0, 0);
            GL11.glRotatef(180, 0, 1, 0);

            break;
        case 3:
            GL11.glTranslatef(0, 1, 0);
            GL11.glRotatef(0, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 2:
            GL11.glTranslatef(1, 1, 1);
            GL11.glRotatef(180, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 5:
            GL11.glTranslatef(0, 1, 1);
            GL11.glRotatef(90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 4:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(-90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        }
        GL11.glTranslatef(dx + displayWidth / 2, 1F, dz + displayHeight / 2);
        GL11.glRotatef(-90, 1, 0, 0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        FontRenderer fontRenderer = this.getFontRenderer();
        int maxWidth = 1;
        String header = "MFFS Capacitor";
        maxWidth = Math.max(fontRenderer.getStringWidth(header), maxWidth);
        maxWidth += 4;
        int lineHeight = fontRenderer.FONT_HEIGHT + 2;
        int requiredHeight = lineHeight * 1;
        float scaleX = displayWidth / maxWidth;
        float scaleY = displayHeight / requiredHeight;
        float scale = Math.min(scaleX, scaleY);
        GL11.glScalef(scale, -scale, scale);
        GL11.glDepthMask(false);
        int offsetX;
        int offsetY;
        int realHeight = (int) Math.floor(displayHeight / scale);
        int realWidth = (int) Math.floor(displayWidth / scale);

        if (scaleX < scaleY) {
            offsetX = 2;
            offsetY = (realHeight - requiredHeight) / 2;
        } else {
            offsetX = (realWidth - maxWidth) / 2 + 2;
            offsetY = 0;
        }
        GL11.glDisable(GL11.GL_LIGHTING);
        fontRenderer.drawString(header, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -2 * lineHeight,
                1);
        fontRenderer.drawString("capacity: ", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 0 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getCapacity()).concat(" % "),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getCapacity()).concat(" % ")),
                offsetY - realHeight / 2 - 0 * lineHeight, 1);
        fontRenderer.drawString("range: ", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getTransmitRange()),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getTransmitRange())),
                offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString("linked device: ", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 2 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getLinketProjektor()),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getLinketProjektor())),
                offsetY - realHeight / 2 + 2 * lineHeight, 1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthMask(true);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPopMatrix();
    }
}

From source file:chb.mods.mffs.client.TEExtractorRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
    if (tileEntity instanceof TileEntityExtractor) {
        TileEntityExtractor topview = (TileEntityExtractor) tileEntity;
        GL11.glPushMatrix();//from  ww  w .  j av a  2s .  c om
        GL11.glPolygonOffset(-10, -10);
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        int side = topview.getSide();
        float dx = 1F / 16;
        float dz = 1F / 16;
        float displayWidth = 1 - 2F / 16;
        float displayHeight = 1 - 2F / 16;
        GL11.glTranslatef((float) x, (float) y, (float) z);
        switch (side) {
        case 1:

            break;
        case 0:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(180, 1, 0, 0);
            GL11.glRotatef(180, 0, 1, 0);

            break;
        case 3:
            GL11.glTranslatef(0, 1, 0);
            GL11.glRotatef(0, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 2:
            GL11.glTranslatef(1, 1, 1);
            GL11.glRotatef(180, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 5:
            GL11.glTranslatef(0, 1, 1);
            GL11.glRotatef(90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        case 4:
            GL11.glTranslatef(1, 1, 0);
            GL11.glRotatef(-90, 0, 1, 0);
            GL11.glRotatef(90, 1, 0, 0);

            break;
        }
        GL11.glTranslatef(dx + displayWidth / 2, 1F, dz + displayHeight / 2);
        GL11.glRotatef(-90, 1, 0, 0);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        FontRenderer fontRenderer = this.getFontRenderer();
        int maxWidth = 1;
        String header = "MFFS Extractor";
        maxWidth = Math.max(fontRenderer.getStringWidth(header), maxWidth);
        maxWidth += 4;
        int lineHeight = fontRenderer.FONT_HEIGHT + 2;
        int requiredHeight = lineHeight * 1;
        float scaleX = displayWidth / maxWidth;
        float scaleY = displayHeight / requiredHeight;
        float scale = Math.min(scaleX, scaleY);
        GL11.glScalef(scale, -scale, scale);
        GL11.glDepthMask(false);
        int offsetX;
        int offsetY;
        int realHeight = (int) Math.floor(displayHeight / scale);
        int realWidth = (int) Math.floor(displayWidth / scale);

        if (scaleX < scaleY) {
            offsetX = 2;
            offsetY = (realHeight - requiredHeight) / 2;
        } else {
            offsetX = (realWidth - maxWidth) / 2 + 2;
            offsetY = 0;
        }
        GL11.glDisable(GL11.GL_LIGHTING);
        fontRenderer.drawString(header, offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -2 * lineHeight,
                1);
        fontRenderer.drawString("WE:", offsetX - realWidth / 2, 1 + offsetY - realHeight / 2 + -0 * lineHeight,
                1);
        fontRenderer.drawString(String.valueOf(topview.getWorkdone()).concat(" % "),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getWorkdone()).concat(" % ")),
                offsetY - realHeight / 2 - 0 * lineHeight, 1);
        fontRenderer.drawString("WC left:", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getWorkCylce()),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(String.valueOf(topview.getWorkCylce())),
                offsetY - realHeight / 2 + 1 * lineHeight, 1);
        fontRenderer.drawString("FE Cap:", offsetX - realWidth / 2,
                1 + offsetY - realHeight / 2 + 2 * lineHeight, 1);
        fontRenderer.drawString(String.valueOf(topview.getForceEnergybuffer() / 1000).concat("k"),
                offsetX + realWidth / 2 - offsetX
                        - fontRenderer.getStringWidth(
                                String.valueOf(topview.getForceEnergybuffer() / 1000).concat("k")),
                offsetY - realHeight / 2 + 2 * lineHeight, 1);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthMask(true);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPopMatrix();
    }
}

From source file:chemistry.electrolysm.client.itemRenderers.ItemRendererBunsenBurner.java

License:Open Source License

@Override
public void render(float x, float y, float z) {
    GL11.glPushMatrix();//w w w  .j  ava2  s  .  c o  m
    GL11.glTranslatef(x, y, z);
    GL11.glTranslatef(0.2F, 1F, 0F);

    if (meta == 0) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(CommonProxy.MODEL_BB_GAS);
    } else if (meta == 1) {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(CommonProxy.MODEL_BB_ELECTRIC);
    } else {
        FMLClientHandler.instance().getClient().renderEngine.bindTexture(CommonProxy.MODEL_BUNSEN_BURNER);
    }
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    // Render
    model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    //model.renderStand(0.0625F);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
    GL11.glPopMatrix();

}

From source file:chemistry.electrolysm.client.itemRenderers.ItemRendererTripod.java

License:Open Source License

@Override
public void render(float x, float y, float z) {
    GL11.glPushMatrix();/* www. ja va 2  s .co  m*/
    GL11.glTranslatef(x, y, z);
    GL11.glTranslatef(0.2F, 1F, 0F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(CommonProxy.MODEL_BUNSEN_BURNER);

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    // Render
    //model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    model.renderStand(0.0625F);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
    GL11.glPopMatrix();

}