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:cn.lambdacraft.mob.client.model.ModelHeadcrab.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);
    if (!entity.onGround) {
        EntityHeadcrab crab = (EntityHeadcrab) entity;
        GL11.glTranslatef(0.0F, 1.5F, 0.0F);
        if (crab.attacher == null) {
            float angle = -MathHelper.sin((crab.ticksExisted - crab.lastJumpTick) * 0.1F) * 40F;
            GL11.glRotatef(angle, 1.0F, 0.0F, 0.0F);
        } else {//from   w  w w . j ava  2  s  . c  o m
            GL11.glRotatef(35F, 1.0F, 0.0F, 0.0F);
        }
        GL11.glTranslatef(0.0F, -1.5F, 0.0F);
    }
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    leg41.render(f5);
    leg31.render(f5);
    body.render(f5);
    leg1.render(f5);
    leg2.render(f5);
    leg3.render(f5);
    leg4.render(f5);
}

From source file:cn.lambdacraft.mob.client.model.ModelVortigaunt.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, -0.45F, 0.0F);
    GL11.glScalef(1.3F, 1.3F, 1.3F);// w  ww.j  a v  a 2s .  c o  m
    EntityAlienSlave slave = (EntityAlienSlave) entity;
    setRotationAngles(f, f1, f2, f3, f4, f5, slave);
    chest.render(f5);
    stomache.render(f5);
    head.render(f5);
    rarm0.render(f5);
    rarm1.render(f5);
    larm0.render(f5);
    larm1.render(f5);
    tent0.render(f5);
    rhand.render(f5);
    lhand.render(f5);
    if (!slave.isCharging) {
        rfinger0.render(f5);
        rfinger1.render(f5);
        lfinger0.render(f5);
        lfinger1.render(f5);
    }
    rear.render(f5);
    lear.render(f5);
    neck.render(f5);
    collar1.render(f5);
    collar2.render(f5);
    collar3.render(f5);
    lcollar1.render(f5);
    collar4.render(f5);
    collar5.render(f5);
    rcollar1.render(f5);
    rleg0.render(f5);
    lleg0.render(f5);
    rleg1.render(f5);
    lleg1.render(f5);
    rleg2.render(f5);
    lleg2.render(f5);
    rleg3.render(f5);
    lleg3.render(f5);
    rleg4.render(f5);
    rleg5.render(f5);
    lleg4.render(f5);
    lleg5.render(f5);
    collar6.render(f5);
}

From source file:cn.lambdacraft.mob.client.renderer.RenderBarnacle.java

License:Open Source License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) {
    EntityBarnacle barnacle = (EntityBarnacle) entity;
    Tessellator t = Tessellator.instance;
    GL11.glPushMatrix();/*  w  ww .ja  v a  2 s  .  c  o m*/
    Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.BARNACLE_PATH);
    GL11.glTranslatef((float) par2, (float) par4 + 2 * entity.height, (float) par6);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    GL11.glTranslatef(0.0F, 1.5F, 0.0F);
    if (barnacle.getHealth() <= 0)
        GL11.glRotatef(barnacle.deathTime * 6.5F, 1.0F, 0.0F, -1.0F);
    GL11.glTranslatef(0.0F, -1.5F, 0.0F);
    if (barnacle.hurtResistantTime > 10)
        GL11.glColor3f(1.0F, 0.5F, 0.5F);

    this.model.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    if (barnacle.getHealth() > 0) {
        //Barnacle Tentacle Render
        double length = barnacle.tentacleLength;
        double h1 = 0.5, h2 = length + 1.0;
        Vec3 v1 = RenderUtils.newV3(-WIDTH, h1, -WIDTH), v2 = RenderUtils.newV3(-WIDTH, h1, WIDTH),
                v3 = RenderUtils.newV3(WIDTH, h1, WIDTH), v4 = RenderUtils.newV3(WIDTH, h1, -WIDTH);
        Vec3 v5 = RenderUtils.newV3(-WIDTH, h1, -WIDTH), v6 = RenderUtils.newV3(-WIDTH, h2, WIDTH),
                v7 = RenderUtils.newV3(WIDTH, h2, WIDTH), v8 = RenderUtils.newV3(WIDTH, h2, -WIDTH);
        Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.BARNACLE_TENTACLE_PATH);

        t.startDrawingQuads();
        RenderUtils.addVertex(v1, 0.0, 0.0);
        RenderUtils.addVertex(v5, 0.0, length);
        RenderUtils.addVertex(v6, 1.0, length);
        RenderUtils.addVertex(v2, 1.0, 0.0);

        RenderUtils.addVertex(v2, 0.0, 0.0);
        RenderUtils.addVertex(v6, 0.0, length);
        RenderUtils.addVertex(v7, 1.0, length);
        RenderUtils.addVertex(v3, 1.0, 0.0);

        RenderUtils.addVertex(v3, 0.0, 0.0);
        RenderUtils.addVertex(v7, 0.0, length);
        RenderUtils.addVertex(v8, 1.0, length);
        RenderUtils.addVertex(v4, 1.0, 0.0);

        RenderUtils.addVertex(v4, 0.0, 0.0);
        RenderUtils.addVertex(v8, 0.0, length);
        RenderUtils.addVertex(v5, 1.0, length);
        RenderUtils.addVertex(v1, 1.0, 0.0);

        RenderUtils.addVertex(v8, 0.0, 0.0);
        RenderUtils.addVertex(v7, 0.0, 0.1);
        RenderUtils.addVertex(v6, 0.1, 0.1);
        RenderUtils.addVertex(v5, 0.1, 0.0);
        t.draw();
    }
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.renderer.RenderHoundeye.java

License:Open Source License

@Override
public void func_110827_b(EntityLiving ent, double par2, double par4, double par6, float par8, float par9) {
    GL11.glPushMatrix();/*from   www. j a va  2s  . c o  m*/
    float yOffset = ent.prevLimbSwingAmount + (ent.limbSwingAmount - ent.prevLimbSwingAmount) * par9;
    float xOffset = 0.0F, zOffset = 0.0F;
    if (((EntityHoundeye) ent).isCharging) {
        xOffset = rand.nextFloat() * 0.3F;
        zOffset = rand.nextFloat() * 0.3F;
        yOffset += rand.nextFloat() * 0.3F;
    }
    if (yOffset > 1.0F)
        yOffset = 1.0F;
    yOffset *= 0.2F;
    GL11.glTranslatef(xOffset, yOffset, zOffset);
    super.func_110827_b(ent, par2, par4, par6, par8, par9);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.renderer.RenderTurret.java

License:Open Source License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float f1) {
    EntitySentry turret = (EntitySentry) entity;
    GL11.glPushMatrix();/* ww  w .j a va  2s .  c  o  m*/
    GL11.glDisable(GL11.GL_CULL_FACE);
    RenderUtils.loadTexture(ClientProps.TURRET_PATH);
    super.doRender(entity, par2, par4, par6, par8, f1);
    GL11.glTranslatef((float) par2, (float) par4 + turret.height - turret.deathTime * 0.06F, (float) par6);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    if (turret.hurtResistantTime > 15)
        GL11.glColor3f(1.0F, 0.3F, 0.3F);
    GL11.glRotatef(turret.deathTime * 3, 1.0F, 0.2F, -1.0F);
    GL11.glRotatef(180.0F - turret.rotationYawHead, 0.0F, 1.0F, 0.0F);
    model.renderTop(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.renderer.RenderVortigauntRay.java

License:Open Source License

@Override
public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) {
    EntityVortigauntRay ray = (EntityVortigauntRay) entity;

    Tessellator tessellator = Tessellator.instance;

    GL11.glPushMatrix();//from  w  w  w  .  j  av a  2s.  co m

    double dx = ray.destX - ray.startX;
    double dy = ray.destY - ray.startY;
    double dz = ray.destZ - ray.startZ;
    double d = Math.sqrt(dx * dx + dy * dy + dz * dz);
    float angle = ray.ticksExisted;
    double tx = 0.0, tz = 0.0;
    double ty = -0.63;

    Vec3 v1 = RenderUtils.newV3(0, 0, -WIDTH), v2 = RenderUtils.newV3(0, 0, WIDTH),

            v5 = RenderUtils.newV3(0, WIDTH, 0), v6 = RenderUtils.newV3(0, -WIDTH, 0);

    // Translations and rotations
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslatef((float) d0, (float) d1, (float) d2);
    // GL11.glRotatef(angle, 1.0F, 0, 0);
    int rand = RenderUtils.rand.nextInt(3);
    Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand]);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    tessellator.startDrawingQuads();
    tessellator.setBrightness(15728880);
    tessellator.setColorRGBA(50, 200, 50, 200);

    RenderUtils.addVertex(v1.addVector(tx, ty, tz), 0, 0);
    RenderUtils.addVertex(v2.addVector(tx, ty, tz), 1, 0);
    RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d);

    RenderUtils.addVertex(v5.addVector(tx, ty, tz), 0, d);
    RenderUtils.addVertex(v6.addVector(tx, ty, tz), 1, d);
    RenderUtils.addVertex(v6.addVector(dx, dy, dz), 1, 0);
    RenderUtils.addVertex(v5.addVector(dx, dy, dz), 0, 0);

    tessellator.draw();

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

From source file:cn.lambdacraft.terrain.client.model.ModelXenLight.java

License:Open Source License

@Override
public void render(TileEntity is, double x, double y, double z, float f1, float scale, float f) {
    TileEntityXenLight tile = (TileEntityXenLight) is;
    GL11.glPushMatrix();/*from w  ww  . j a v  a  2  s.  c o  m*/
    GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    RenderUtils.loadTexture(ClientProps.XENLIGHT_PATH);
    Shape1.render(scale);
    //~
    GL11.glRotated(12.5 * MathHelper.sin(tile.ticksExisted * 0.07F), 0.1, 1, -0.1);
    if (tile.isLighting) {
        if (tile.tickSinceChange < 15)
            GL11.glTranslatef(0.0F, 0.0166F * (15 - tile.tickSinceChange), 0.0F);
    } else {
        if (tile.tickSinceChange < 5)
            GL11.glTranslatef(0.0F, 0.05F * tile.tickSinceChange, 0.0F);
        else
            GL11.glTranslatef(0.0F, 0.25F, 0.0F);
    }
    Shape2.render(scale);
    Shape3.render(scale);
    GL11.glPopMatrix();
}

From source file:cn.lambdalib.template.client.render.entity.RenderCrossedProjectile.java

License:MIT License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) {
    Motion3D motion = new Motion3D(entity);
    Tessellator t = Tessellator.instance;

    GL11.glPushMatrix();//from   w ww . j a  va 2 s. c o m
    {
        Vec3 v1 = newV3(0, HEIGHT, 0), v2 = newV3(0, -HEIGHT, 0), v3 = newV3(LENGTH, -HEIGHT, 0),
                v4 = newV3(LENGTH, HEIGHT, 0), v5 = newV3(0, 0, -HEIGHT), v6 = newV3(0, 0, HEIGHT),
                v7 = newV3(LENGTH, 0, HEIGHT), v8 = newV3(LENGTH, 0, -HEIGHT);

        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        if (renderTexture) {
            bindTexture(TEXTURE_PATH);
        } else {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glColor3f(colorR, colorG, colorB);
        }
        if (ignoreLight) {
            GL11.glDisable(GL11.GL_LIGHTING);
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
        }

        GL11.glTranslatef((float) par2, (float) par4, (float) par6);

        GL11.glRotatef(90 + entity.rotationYaw, 0.0F, -1.0F, 0.0F); // ?
        GL11.glRotatef(-entity.rotationPitch, 0.0F, 0.0F, 1.0F); // 

        if (this.playerViewOptm) {
            boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0;
            if (firstPerson) {
                GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ);
            } else {
                GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ);
            }
        }

        t.startDrawingQuads();
        if (ignoreLight)
            t.setBrightness(15728880);

        RenderUtils.addVertex(v1, 0, 0);
        RenderUtils.addVertex(v2, 0, 1);
        RenderUtils.addVertex(v3, 1, 1);
        RenderUtils.addVertex(v4, 1, 0);

        RenderUtils.addVertex(v5, 0, 0);
        RenderUtils.addVertex(v6, 0, 1);
        RenderUtils.addVertex(v7, 1, 1);
        RenderUtils.addVertex(v8, 1, 0);

        t.draw();

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

From source file:cn.lambdalib.template.client.render.entity.RenderIcon.java

License:MIT License

@Override
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
    GL11.glEnable(GL11.GL_BLEND);//  w  w  w.j av a  2  s. c o  m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_CULL_FACE);
    if (!hasLight)
        GL11.glDisable(GL11.GL_LIGHTING);
    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, minTolerateAlpha);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef((float) par2, (float) par4, (float) par6);
        GL11.glScalef(size, size, size);
        postTranslate(par1Entity);
        if (icon != null)
            RenderUtils.loadTexture(icon);

        Tessellator t = Tessellator.instance;
        this.func_77026_a(par1Entity, t);

    }
    GL11.glPopMatrix();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.lambdalib.util.client.RenderUtils.java

License:MIT License

public static void renderOverlayEquip(ResourceLocation src) {
    //Setup//from  w  ww.j ava 2 s .c o m
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDisable(GL11.GL_LIGHTING);
    loadTexture(src);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    float f7 = 0.76F;
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    //Push texture mat
    GL11.glPushMatrix();
    float f8 = 0.125F;
    GL11.glScalef(f8, f8, f8);
    float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
    GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();

    //Second pass
    GL11.glPushMatrix();
    GL11.glScalef(f8, f8, f8);
    f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop
    GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation!
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();
    //Pop texture mat
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}