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:chemistry.electrolysm.client.RenderTileBunsenBurner.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float v4) {
    renderTripod = ((TileEntityBunsenBurner) tileEntity).hasStand();
    renderTestTube = ((TileEntityBunsenBurner) tileEntity).hasTestTube();

    //System.out.println("render");
    GL11.glPushMatrix();/*  ww  w.  j  a va 2  s .  co m*/
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    rotateByMeta(tileEntity.getBlockMetadata());

    Block block = tileEntity.getWorldObj().getBlock(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
    if (block instanceof BlockBBElectric) {
        bindTexture(CommonProxy.MODEL_BB_ELECTRIC);
    } else if (block instanceof BlockBBGas) {
        bindTexture(CommonProxy.MODEL_BB_GAS);
    } else {
        bindTexture(CommonProxy.MODEL_BUNSEN_BURNER);
    }
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    if (renderTripod) {
        model.renderStand(0.0625F);
        if (renderTestTube) {
            model.renderTestTube(0.0625F);
        }
    }
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:chemistry.electrolysm.client.RenderTileCleaner.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float v4) {
    GL11.glPushMatrix();//ww  w  .  jav a2 s.  c  o m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    bindTexture(CommonProxy.MODEL_CLEANER);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    rotateByMeta(tileEntity.getBlockMetadata());
    model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    if (((TileEntityCleaner) tileEntity).tankWater
            .getFluidAmount() >= (((TileEntityCleaner) tileEntity).tankWater.getCapacity() / 2)) {
        model.renderLiquid(0.0625F);
    }
    GL11.glPopMatrix();
}

From source file:chemistry.electrolysm.client.RenderTileMassSpec.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float v4) {
    GL11.glPushMatrix();//from   w  w  w . ja v a 2s.  c  o m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    bindTexture(CommonProxy.MODEL_MASS_SPEC);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    rotateByMeta(tileEntity.getBlockMetadata());
    model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

private void drawPlayer() {
    EntityPlayer player = dev.user;/*from   www. j  a  v  a2 s .c  om*/
    RenderUtils.loadTexture(RenderUtils.STEVE_TEXTURE);
    float x = 100, y = 100, scale = 2.1F;
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef(183, 58, 100F);
        GL11.glScalef((-scale), scale, scale);
        GL11.glRotated(-25, 1, 0, 0);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(Minecraft.getSystemTime() / 100F, 0F, 1F, 0F); //Rotate around Y
        model.render(player, 0, 0, 0, 0, 0, 1F);
    }
    GL11.glPopMatrix();
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
}

From source file:cn.academy.core.client.gui.GuiPresetSelect.java

License:Open Source License

@Override
public void draw(ScaledResolution sr) {
    int h = sr.getScaledHeight(), w = sr.getScaledWidth();
    GL11.glEnable(GL11.GL_BLEND);/*from  w  w w. ja v a2  s .com*/
    GL11.glPushMatrix();
    {
        float x0 = w / 2F, y0 = h / 2F, scale = 0.32F;
        GL11.glTranslated(0, -5, 0);
        GL11.glTranslatef(x0, y0, 0);
        GL11.glScalef(scale, scale, 1);

        HudUtils.setTextureResolution(768, 512);
        RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET);
        long dt = Minecraft.getSystemTime() - lastOpenTime;
        drawSelectionMenu(w, h, dt);
        drawPresetInfo(w, h, dt);
        drawTag(w, h, dt);
    }
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.academy.core.client.render.RenderVoid.java

License:Open Source License

public static final void renderHand(EntityPlayer player) {

    GL11.glDisable(GL11.GL_CULL_FACE);/*from  w  w w. j  av  a  2 s.  c  o  m*/
    GL11.glPushMatrix();

    RenderUtils.renderEnchantGlint_Equip();
    RenderUtils.loadTexture(steveTexture);
    GL11.glRotated(-23.75, 0.0F, 0.0F, 1.0F);
    GL11.glRotated(21.914, 0.0F, 1.0F, 0.0F);
    GL11.glRotated(32.75, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(.758F, -.072F, -.402F);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);

    model.onGround = 0.0F;
    model.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player);
    model.bipedRightArm.render(0.0625F);

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

From source file:cn.academy.vanilla.generic.client.render.RippleMarkRender.java

License:GNU General Public License

@Override
public void doRender(Entity entity, double x, double y, double z, float a, float b) {
    EntityRippleMark mark = (EntityRippleMark) entity;
    long dt = GameTimer.getTime() - mark.creationTime;

    GL11.glDisable(GL11.GL_CULL_FACE);/*from   ww w  .  j  ava2 s. co  m*/
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);

    for (int i = 0; i < timeOffsets.length; ++i) {
        GL11.glPushMatrix();

        long mod = (dt - timeOffsets[i]) % CYCLE;
        float size = getSize(mod);

        GL11.glTranslatef(0, getHeight(mod), 0);
        GL11.glScalef(size, 1, size);
        material.color = mark.color.copy();
        material.color.a *= getAlpha(mod);
        mesh.draw(material);

        GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:cn.lambdacraft.crafting.client.renderer.RenderWire.java

License:Open Source License

private void renderWireBox(Tessellator t, int side, boolean[] theArray) {
    ForgeDirection[] dirs = ForgeDirection.values();
    Vec3 v1 = RenderUtils.newV3(-WIDTH, -WIDTH, -WIDTH), v2 = RenderUtils.newV3(WIDTH, -WIDTH, -WIDTH),
            v3 = RenderUtils.newV3(WIDTH, -WIDTH, WIDTH), v4 = RenderUtils.newV3(-WIDTH, -WIDTH, WIDTH),
            v5 = RenderUtils.newV3(-WIDTH, WIDTH, -WIDTH), v6 = RenderUtils.newV3(WIDTH, WIDTH, -WIDTH),
            v7 = RenderUtils.newV3(WIDTH, WIDTH, WIDTH), v8 = RenderUtils.newV3(-WIDTH, WIDTH, WIDTH);
    GL11.glPushMatrix();//from ww  w  . j  av a  2  s.  c o m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float dx = 0.0F, dy = 0.0F, dz = 0.0F;
    switch (side) {
    case 0:
        dy = -1;
        break;
    case 1:
        dy = 1;
        break;
    case 4:
        dx = -1;
        break;
    case 5:
        dx = 1;
        break;
    case 2:
        dz = -1;
        break;
    case 3:
        dz = 1;
        break;
    }
    float offset = (0.5F + WIDTH) / 2F;
    GL11.glTranslatef(dx * offset, dy * offset, dz * offset);
    if (side != -1) {
        float scale = 2F;
        GL11.glScalef(Math.abs(dx == 0.0F ? 1 : dx * scale), Math.abs(dy == 0.0F ? 1 : dy * scale),
                Math.abs(dz == 0.0F ? 1 : dz * scale));
    }
    int a = 0;
    for (int i = 0; i < theArray.length; i++)
        if (theArray[i])
            a++;
    for (int i = 0; i < 6; i++) {
        if (!doesRenderSide(side, i, theArray))
            continue;
        Vec3 vec1 = null, vec2 = null, vec3 = null, vec4 = null;
        dx = 0.0F;
        dy = 0.0F;
        dz = 0.0F;
        switch (i) {
        case 0:
            vec1 = v4;
            vec2 = v3;
            vec3 = v2;
            vec4 = v1;
            dy = -1.0F;
            break;
        case 1:
            vec1 = v5;
            vec2 = v6;
            vec3 = v7;
            vec4 = v8;
            dy = 1.0F;
            break;
        case 4:
            vec1 = v1;
            vec2 = v5;
            vec3 = v8;
            vec4 = v4;
            dx = -1.0F;
            break;
        case 5:
            vec1 = v2;
            vec2 = v3;
            vec3 = v7;
            vec4 = v6;
            dx = 1.0F;
            break;
        case 2:
            vec1 = v1;
            vec2 = v2;
            vec3 = v6;
            vec4 = v5;
            dz = -1.0F;
            break;
        case 3:
            vec1 = v4;
            vec2 = v8;
            vec3 = v7;
            vec4 = v3;
            dz = 1.0F;
            break;
        }
        GL11.glPushMatrix();
        if (side == -1) {
            if (a == 1 && theArray[dirs[i].getOpposite().ordinal()])
                RenderUtils.loadTexture(ClientProps.WIRE_MAIN_PATH);
            else
                RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH);
        } else {
            RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH2);
        }

        t.startDrawingQuads();
        t.setNormal(dx, dy, dz);
        RenderUtils.addVertex(vec4, 0.0, 1.0);
        RenderUtils.addVertex(vec3, 1.0, 1.0);
        RenderUtils.addVertex(vec2, 1.0, 0.0);
        RenderUtils.addVertex(vec1, 0.0, 0.0);
        t.draw();
        GL11.glPopMatrix();
    }
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.deathmatch.client.HEVRenderingUtils.java

License:Open Source License

public static void drawPlayerHud(EntityPlayer player, ScaledResolution resolution, float partialTickTime) {

    int k = resolution.getScaledWidth();
    int l = resolution.getScaledHeight();
    int i2 = k / 2 - 91;
    int k2 = l - 32 + 3;
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager engine = mc.renderEngine;
    GL11.glEnable(GL11.GL_BLEND);/*  www .ja va2 s .  c o m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F);
    engine.bindTexture(ClientProps.HEV_HUD_PATH);

    GL11.glPushMatrix();

    double scale = 0.00026 * mc.displayWidth + 0.3;

    float xOffset, yOffset;
    xOffset = 10;
    yOffset = l - 20;
    GL11.glTranslatef(xOffset, yOffset, 0.0F);

    GL11.glScaled(scale, scale, 1.0);
    //Health Section
    HudUtils.setTextureResolution(TEX_WIDTH, TEX_HEIGHT);

    GL11.glColor4f(0.7F, 0.7F, 0.7F, 0.6F);
    HudUtils.drawTexturedModalRect(0, 0, 64, 64, 24, 24, 64, 64);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F);
    int h = (int) (player.getHealth() * 16 / 20);
    HudUtils.drawTexturedModalRect(0, 24 - (int) (h * 1.5), 192, 128 - 4 * h, 24, (int) (1.5 * h), 64, 4 * h);
    if (player.getHealth() <= 5)
        GL11.glColor4f(0.9F, 0.1F, 0.1F, 0.6F);
    drawNumberAt((byte) (player.getHealth() * 5), 18, 0);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.9F);

    //Armor Section
    GL11.glColor4f(0.7F, 0.7F, 0.7F, 0.6F);
    HudUtils.drawTexturedModalRect(70, 0, 0, 64, 24, 24, 64, 64);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F);
    h = player.getTotalArmorValue() * 16 / 20;
    if (h > 16)
        h = 16;
    HudUtils.drawTexturedModalRect(70, 24 - (int) (h * 1.5), 128, 128 - 4 * h, 24, (int) (h * 1.5), 64, 4 * h);

    drawNumberAt(player.getTotalArmorValue() * 5, 70 + 12, 0);

    GL11.glPopMatrix();

    //Other section
    drawArmorTip(player, engine, k, l);
    if (LCClientPlayer.drawArmorTip)
        drawWeaponTip(player, engine, k, l);

    engine.bindTexture(engine.getResourceLocation(1));
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.7F);
}

From source file:cn.lambdacraft.deathmatch.client.model.ModelMedkit.java

License:Open Source License

@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    super.render(entity, f, f1, f2, f3, f4, f5);
    GL11.glTranslatef(0.0F, -1.1F, 0.0F);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    Shape1.render(f5);//from ww  w.  jav a  2s .  c om
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
}