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:arekkuusu.grimoireOfAlice.client.render.LargeItemRenderer.java

License:Open Source License

private void doTheStuff(ItemStack stack, EntityLivingBase entity, boolean view) {
    GL11.glPushMatrix();//  w w  w. ja  v a  2s  .  c om
    double size = scale;
    if (view) {
        size *= 1.75F;
        GL11.glTranslated(-0.35F * scale, -0.125F * scale, 0.0F);
    } else {
        size *= (entity instanceof EntityPlayer ? 2.0F : 1.75F);
        GL11.glTranslated(1.0D - size, -0.125D * scale, 0.05D * scale);
        if (rotate != 0) {
            GL11.glTranslated(2.0D - size, -2.125D * scale, 0.05D * scale);
            GL11.glTranslatef(0, 4, 0);
            GL11.glTranslated(1.2, -2, -0.1);
        }
    }
    GL11.glScaled(size, size, size);
    IIcon icon = stack.getItem().getIcon(stack, 0);
    Tessellator tessellator = Tessellator.instance;
    ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(),
            icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    GL11.glPopMatrix();
}

From source file:aritzh.afm.client.render.model.ModelTestModel.java

License:LGPL

public void render(final double x, final double y, final double z) {

    GL11.glPushMatrix();//from  w  w w .  jav a  2 s .c  o m
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glTranslated(x + .5, y - .5, z + .5);
    FMLClientHandler.instance().getClient().renderEngine
            .func_110577_a(new ResourceLocation(Config.MOD_ID.toLowerCase(), RenderingData.TEXTURE_TESTMODEL));

    this.model.renderAll();

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

From source file:aritzh.afm.client.render.model.ModelWireless.java

License:LGPL

public void render(final double x, final double y, final double z) {

    GL11.glPushMatrix();/*from   w  w w  .  j  a  v a 2  s  . co m*/
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glTranslated(x + .5, y - .5, z + .5);
    FMLClientHandler.instance().getClient().renderEngine
            .func_110577_a(new ResourceLocation(Config.MOD_ID.toLowerCase(), RenderingData.TEXTURE_WIRELESS));

    this.model.renderAll();

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

From source file:basedefense.client.renderer.item.surveillance.GooglyEyeRenderer.java

License:Apache License

/**
 * Handles {@link RenderLivingEvent}./*from  ww w.  j  a v  a  2  s .co m*/
 *
 * @param event The event.
 */
@SubscribeEvent
public void onRenderLiving(RenderLivingEvent.Post event) {
    EntityLivingBase entity = event.entity;
    if (!GooglyGlassesItem.ITEM.isPlayerWearing())
        return;

    EntityConfiguration configuration = EntityConfiguration.valueOf(entity.getClass());
    if (configuration == null)
        return;

    GL11.glPushMatrix();
    {
        GL11.glTranslated(event.x, event.y, event.z);
        GL11.glTranslatef(0.0f, configuration.getRotationCenterY(), 0.0f);

        GL11.glRotatef(entity.getRotationYawHead(), 0.0f, -1.0f, 0.0f);

        GL11.glPushMatrix();
        {
            GL11.glRotatef(entity.rotationPitch, 1.0f, 0.0f, 0.0f);
            GL11.glTranslatef(0.0f, configuration.getEyeOffsetY(), configuration.getEyeOffsetZ());

            this.renderModel(configuration.getEyeOffsetX(), configuration.getEyeScale());
            this.renderModel(-configuration.getEyeOffsetX(), configuration.getEyeScale());
        }
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}

From source file:boilerplate.client.fx.FXRaygun.java

License:Minecraft Mod Public

@Override
public void renderParticle(final Tessellator tessellator, final float f, final float f1, final float f2,
        final float f3, final float f4, final float f5) {
    tessellator.draw();/*from  ww w  .  ja v  a2 s .  com*/
    GL11.glPushMatrix();
    final float var9 = 1.0F;
    final float slide = this.worldObj.getWorldTime();
    final float rot = ((this.worldObj.provider.getWorldTime() % (360 / this.rotationspeed))
            * this.rotationspeed) + (this.rotationspeed * f);
    float size = 0.5F;

    if (this.pulse) {
        size = Math.min(this.particleAge / 4.0F, 1.0F);
        size = this.prevSize + ((size - this.prevSize) * f);
    }

    float op = 0.4F;

    if ((this.pulse) && ((this.particleMaxAge - this.particleAge) <= 4)) {
        op = 0.4F - ((4 - (this.particleMaxAge - this.particleAge)) * 0.1F);
    }

    switch (this.type) {
    default:
        // In case I make another type of beam, I can change the beam
        // texture here
        break;
    case 1:
        // and here...
        break;
    case 2:
        ClientHelper.textureManager().bindTexture(rayTex);
    }

    GL11.glTexParameterf(3553, 10242, 10497.0F);
    GL11.glTexParameterf(3553, 10243, 10497.0F);
    GL11.glDisable(2884);
    float var11 = slide + f;

    if (this.reverse) {
        var11 *= -1.0F; // why name your variables "var11"? That is so
        // un-helpful
    }

    final float var12 = (-var11 * 0.2F) - MathHelper.floor_float(-var11 * 0.1F);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 1);
    GL11.glDepthMask(false);
    double prex = this.player.prevPosX;
    double prey = this.player.prevPosY + this.offset;
    double prez = this.player.prevPosZ;
    double px = this.player.posX;
    double py = this.player.posY + this.offset;
    double pz = this.player.posZ;
    prex -= MathHelper.cos((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.066F;
    prey -= 0.06D;
    prez -= MathHelper.sin((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.04F;
    Vec3 vec3d = this.player.getLook(1.0F);
    prex += vec3d.xCoord * 0.3D;
    prey += vec3d.yCoord * 0.3D;
    prez += vec3d.zCoord * 0.3D;
    px -= MathHelper.cos((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.066F;
    py -= 0.06D;
    pz -= MathHelper.sin((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.04F;
    vec3d = this.player.getLook(1.0F);
    px += vec3d.xCoord * 0.3D;
    py += vec3d.yCoord * 0.3D;
    pz += vec3d.zCoord * 0.3D;
    final float xx = (float) ((prex + ((px - prex) * f)) - EntityFX.interpPosX);
    final float yy = (float) ((prey + ((py - prey) * f)) - EntityFX.interpPosY);
    final float zz = (float) ((prez + ((pz - prez) * f)) - EntityFX.interpPosZ);
    GL11.glTranslated(xx, yy, zz);
    final float ry = this.prevYaw + ((this.rotYaw - this.prevYaw) * f);
    final float rp = this.prevPitch + ((this.rotPitch - this.prevPitch) * f);
    GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(180.0F + ry, 0.0F, 0.0F, -1.0F);
    GL11.glRotatef(rp, 1.0F, 0.0F, 0.0F);
    final double var44 = -0.15D * size;
    final double var17 = 0.15D * size;
    final double var44b = -0.15D * size * this.endMod;
    final double var17b = 0.15D * size * this.endMod;
    GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);

    for (int t = 0; t < 5; t++) {
        final double var29 = this.length * size * var9;
        final double var31 = 0.0D;
        final double var33 = 1.0D;
        final double var35 = -1.0F + var12 + (t / 3.0F);
        final double var37 = (this.length * size * var9) + var35;
        GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.setBrightness(200);
        tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, op);
        tessellator.addVertexWithUV(var44b, var29, 0.0D, var33, var37);
        tessellator.addVertexWithUV(var44, 0.0D, 0.0D, var33, var35);
        tessellator.addVertexWithUV(var17, 0.0D, 0.0D, var31, var35);
        tessellator.addVertexWithUV(var17b, var29, 0.0D, var31, var37);
        tessellator.draw();
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDepthMask(true);
    GL11.glDisable(3042);
    GL11.glEnable(2884);
    GL11.glPopMatrix();
    tessellator.startDrawingQuads();
    this.prevSize = size;
}

From source file:buildcraft.builders.render.RenderArchitect.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileArchitect architect = (TileArchitect) tileentity;

    GL11.glPushMatrix();//from  ww  w. j a  va 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);

    for (LaserData laser : architect.subLasers) {
        if (laser != null) {
            GL11.glPushMatrix();
            RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                    EntityLaser.LASER_TEXTURES[3]);

            GL11.glPopMatrix();
        }
    }

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.builders.render.RenderConstructionMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileConstructionMarker marker = (TileConstructionMarker) tileentity;

    GL11.glPushMatrix();//from ww w . j a va 2 s  .com
    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);

    if (marker.laser != null) {
        GL11.glPushMatrix();
        RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, marker.laser,
                EntityLaser.LASER_TEXTURES[4]);
        GL11.glPopMatrix();
    }

    if (marker.itemBlueprint != null) {
        doRenderItem(marker.itemBlueprint, marker.xCoord + 0.5F, marker.yCoord + 0.2F, marker.zCoord + 0.5F);
    }

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

    renderItems.render(tileentity, x, y, z);
}

From source file:buildcraft.builders.RenderArchitect.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileArchitect architect = (TileArchitect) tileentity;

    if (architect != null) {
        GL11.glPushMatrix();//from w  ww  . j a v a 2s  .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);

        for (LaserData laser : architect.subLasers) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaserWave(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                        EntityLaser.LASER_TEXTURES[3]);

                GL11.glPopMatrix();
            }
        }

        GL11.glPopAttrib();
        GL11.glPopMatrix();
    }
}

From source file:buildcraft.builders.RenderBuilder.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileAbstractBuilder builder = (TileAbstractBuilder) tileentity;

    if (builder != null) {
        GL11.glPushMatrix();//from  w  w  w .j  av 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);

        if (builder.getPathLaser() != null) {
            for (LaserData laser : builder.getPathLaser()) {
                if (laser != null) {
                    GL11.glPushMatrix();
                    RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, laser,
                            EntityLaser.LASER_TEXTURES[4]);
                    GL11.glPopMatrix();
                }
            }
        }

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

    GL11.glPushMatrix();

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

    if (builder.getBuilders() != null) {
        for (BuildingItem i : builder.getBuilders()) {
            doRenderItem(i, 1.0F);
        }
    }

    GL11.glPopMatrix();
}

From source file:buildcraft.builders.RenderConstructionMarker.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    super.renderTileEntityAt(tileentity, x, y, z, f);

    TileConstructionMarker marker = (TileConstructionMarker) tileentity;

    if (marker != null) {
        GL11.glPushMatrix();/*w w w. j  av a  2s  .co 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);

        if (marker.laser != null) {
            GL11.glPushMatrix();
            RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.field_147553_e, marker.laser,
                    EntityLaser.LASER_TEXTURES[4]);
            GL11.glPopMatrix();
        }

        if (marker.itemBlueprint != null) {
            doRenderItem(marker.itemBlueprint, marker.xCoord + 0.5F, marker.yCoord + 0.2F,
                    marker.zCoord + 0.5F);
        }

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

        renderItems.render(tileentity, x, y, z);
    }
}