Example usage for org.lwjgl.opengl GL11 glColor4d

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

Introduction

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

Prototype

public static native void glColor4d(@NativeType("GLdouble") double red, @NativeType("GLdouble") double green,
        @NativeType("GLdouble") double blue, @NativeType("GLdouble") double alpha);

Source Link

Document

Double version of #glColor4b Color4b

Usage

From source file:org.cogaen.lwjgl.scene.SpriteFxVisual.java

License:Open Source License

@Override
public void render() {
    if (this.flipVertical) {
        GL11.glScaled(1, -1, 1);/*  w ww  . j  a v a2s .c  o  m*/
    }

    if (this.shadow) {
        double dx = this.halfWidth * getScale() * 0.02;
        double dy = this.halfWidth * getScale() * 0.02;
        GL11.glColor4d(getColor().getRed() * 0.1, getColor().getGreen() * 0.1, getColor().getBlue() * 0.1, 0.7);

        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0.0f, this.texture.getHeight());
        GL11.glVertex2d(-this.halfWidth * getScale() + dx, -this.halfHeight * getScale() - dy);

        GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
        GL11.glVertex2d(this.halfWidth * getScale() + dx, -this.halfHeight * getScale() - dy);

        GL11.glTexCoord2f(this.texture.getWidth(), 0);
        GL11.glVertex2d(this.halfWidth * getScale() + dx, this.halfHeight * getScale() - dy);

        GL11.glTexCoord2f(0.0f, 0.0f);
        GL11.glVertex2d(-this.halfWidth * getScale() + dx, this.halfHeight * getScale() - dy);
    }

    getColor().apply();

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, this.texture.getHeight());
    GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale());

    GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
    GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale());

    GL11.glTexCoord2f(this.texture.getWidth(), 0);
    GL11.glVertex2d(this.halfWidth * getScale(), this.halfHeight * getScale());

    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2d(-this.halfWidth * getScale(), this.halfHeight * getScale());

    if (this.mirror) {
        GL11.glColor4d(getColor().getRed() * 0.7, getColor().getGreen() * 0.7, getColor().getBlue() * 0.7, 0.7);

        GL11.glTexCoord2f(0.0f, this.texture.getHeight());
        GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale());

        GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
        GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale());

        GL11.glColor4d(getColor().getRed(), getColor().getGreen(), getColor().getBlue(), 0);
        GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight() / 2);
        GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * 2 * getScale());

        GL11.glTexCoord2f(0.0f, this.texture.getHeight() / 2);
        GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * 2 * getScale());
    }

    GL11.glEnd();
}

From source file:org.spout.api.gui.layout.AbstractLayout.java

License:Open Source License

@Override
public void render() {
    for (Widget widget : attachedWidgets) {
        double x = widget.getGeometry().getX();
        double y = widget.getGeometry().getY();
        GL11.glTranslated(x, y, 0);/*w  ww. j  a va2  s  . c  om*/
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glPushMatrix();
        widget.render();
        GL11.glPopMatrix();
        GL11.glTranslated(-x, -y, 0);
    }
}

From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java

License:Open Source License

public static void renderTorpedoPath(VehicleBase vehicle, EntityPlayer player, float partialTick) {
    GL11.glPushMatrix();/*w  w w .  ja va2s . c om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor4d(1, 1, 1, 0.6d);

    double x1 = vehicle.posX - player.posX;
    double y1 = vehicle.posY - player.posY;
    double z1 = vehicle.posZ - player.posZ;

    /**
     * vectors for a straight line
     */
    double x2 = x1
            - 20 * Trig.sinDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed());
    double y2 = y1;
    double z2 = z1
            - 20 * Trig.cosDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed());
    GL11.glLineWidth(3f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3d(x1, y1 + 0.12d, z1);
    GL11.glVertex3d(x2, y2 + 0.12d, z2);
    GL11.glEnd();

    GL11.glLineWidth(4f);
    GL11.glColor4f(1.f, 0.4f, 0.4f, 0.4f);
    GL11.glBegin(GL11.GL_LINES);

    Pos3f offset = vehicle.getMissileOffset();
    x2 = x1 + offset.x;
    y2 = y1 + offset.y;
    z2 = z1 + offset.z;

    double gravity = 9.81d * 0.05d * 0.05d;
    double speed = vehicle.localLaunchPower * 0.05d;
    double angle = 90 - vehicle.localTurretPitch - vehicle.rotationPitch;
    double yaw = vehicle.localTurretRotation + partialTick * vehicle.moveHelper.getRotationSpeed();

    double vH = -Trig.sinDegrees((float) angle) * speed;
    double vY = Trig.cosDegrees((float) angle) * speed;
    double vX = Trig.sinDegrees((float) yaw) * vH;
    double vZ = Trig.cosDegrees((float) yaw) * vH;
    int rocketBurnTime = (int) (speed * 20.f * AmmoHwachaRocket.burnTimeFactor);

    float xAcc = (float) (vX / speed) * AmmoHwachaRocket.accelerationFactor;
    ;
    float yAcc = (float) (vY / speed) * AmmoHwachaRocket.accelerationFactor;
    ;
    float zAcc = (float) (vZ / speed) * AmmoHwachaRocket.accelerationFactor;
    ;
    vX = xAcc;
    vY = yAcc;
    vZ = zAcc;
    float dist = 0;

    while (dist < 100 * 100) {
        GL11.glVertex3d(x2, y2, z2);
        x2 += vX;
        z2 += vZ;
        y2 += vY;
        dist += x2 * x2 + z2 * z2 + y2 * y2;
        GL11.glVertex3d(x2, y2, z2);
    }
    GL11.glEnd();

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java

License:Open Source License

public static void renderRocketFlightPath(VehicleBase vehicle, EntityPlayer player, float partialTick) {
    GL11.glPushMatrix();/*from w ww  . ja  va2  s . co  m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor4d(1, 1, 1, 0.6d);

    double x1 = vehicle.posX - player.posX;
    double y1 = vehicle.posY - player.posY;
    double z1 = vehicle.posZ - player.posZ;

    /**
     * vectors for a straight line
     */
    double x2 = x1
            - 20 * Trig.sinDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed());
    double y2 = y1;
    double z2 = z1
            - 20 * Trig.cosDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed());
    GL11.glLineWidth(3f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3d(x1, y1 + 0.12d, z1);
    GL11.glVertex3d(x2, y2 + 0.12d, z2);
    GL11.glEnd();

    GL11.glLineWidth(4f);
    GL11.glColor4f(1.f, 0.4f, 0.4f, 0.4f);
    GL11.glBegin(GL11.GL_LINES);

    Pos3f offset = vehicle.getMissileOffset();
    x2 = x1 + offset.x;
    y2 = y1 + offset.y;
    z2 = z1 + offset.z;

    double gravity = 9.81d * 0.05d * 0.05d;
    double speed = vehicle.localLaunchPower * 0.05d;
    double angle = 90 - vehicle.localTurretPitch - vehicle.rotationPitch;
    double yaw = vehicle.localTurretRotation + partialTick * vehicle.moveHelper.getRotationSpeed();

    double vH = -Trig.sinDegrees((float) angle) * speed;
    double vY = Trig.cosDegrees((float) angle) * speed;
    double vX = Trig.sinDegrees((float) yaw) * vH;
    double vZ = Trig.cosDegrees((float) yaw) * vH;
    int rocketBurnTime = (int) (speed * 20.f * AmmoHwachaRocket.burnTimeFactor);

    if (vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR1
            || vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR2) {
        vY += vehicle.motionY;
        vX += vehicle.motionX;
        vZ += vehicle.motionZ;
        y1 = -player.posY;
    }

    float xAcc = (float) (vX / speed) * AmmoHwachaRocket.accelerationFactor;
    ;
    float yAcc = (float) (vY / speed) * AmmoHwachaRocket.accelerationFactor;
    ;
    float zAcc = (float) (vZ / speed) * AmmoHwachaRocket.accelerationFactor;
    ;
    vX = xAcc;
    vY = yAcc;
    vZ = zAcc;

    while (y2 >= y1) {
        GL11.glVertex3d(x2, y2, z2);
        x2 += vX;
        z2 += vZ;
        y2 += vY;
        if (rocketBurnTime > 0) {
            rocketBurnTime--;
            vX += xAcc;
            vY += yAcc;
            vZ += zAcc;
        } else {
            vY -= gravity;
        }
        GL11.glVertex3d(x2, y2, z2);
    }
    GL11.glEnd();

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java

License:Open Source License

public static void renderBatteringRamOverlay(VehicleBase vehicle, EntityPlayer player, float partialTick) {
    GL11.glPushMatrix();/*w  ww. j a v  a2  s  .c  om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    //  GL11.glDisable(GL11.GL_LIGHTING);
    //  GL11.glDisable(GL11.GL_DEPTH_TEST);
    //GL11.glDepthMask(false);
    GL11.glColor4d(1, 1, 1, 0.6d);

    double x1 = vehicle.posX - player.posX;
    double y1 = vehicle.posY - player.posY;
    double z1 = vehicle.posZ - player.posZ;

    /**
     * vectors for a straight line
     */
    double x2 = x1 - 20 * Trig.sinDegrees(vehicle.rotationYaw);
    double y2 = y1;
    double z2 = z1 - 20 * Trig.cosDegrees(vehicle.rotationYaw);
    GL11.glLineWidth(3f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3d(x1, y1 + 0.12d, z1);
    GL11.glVertex3d(x2, y2 + 0.12d, z2);
    GL11.glEnd();

    Pos3f offset = vehicle.getMissileOffset();
    x2 = x1 + offset.x;
    y2 = y1 + offset.y;
    z2 = z1 + offset.z;
    float bx = (float) (vehicle.posX + offset.x);
    float by = (float) (vehicle.posY + offset.y);
    float bz = (float) (vehicle.posZ + offset.z);
    BlockPosition blockHit = new BlockPosition(bx, by, bz);
    AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(blockHit.x - 1, blockHit.y, blockHit.z, blockHit.x + 2,
            blockHit.y + 1, blockHit.z + 1);
    bb = AWRenderHelper.instance().adjustBBForPlayerPos(bb, player, partialTick);
    BoundingBoxRender.drawOutlinedBoundingBox(bb, 1.f, 0.2f, 0.2f);
    bb = resetBoundingBox(bb, blockHit.x, blockHit.y, blockHit.z - 1, blockHit.x + 1, blockHit.y + 1,
            blockHit.z + 2);
    bb = AWRenderHelper.instance().adjustBBForPlayerPos(bb, player, partialTick);
    BoundingBoxRender.drawOutlinedBoundingBox(bb, 1.f, 0.2f, 0.2f);
    bb = resetBoundingBox(bb, blockHit.x, blockHit.y - 1, blockHit.z, blockHit.x + 1, blockHit.y + 2,
            blockHit.z + 1);
    bb = AWRenderHelper.instance().adjustBBForPlayerPos(bb, player, partialTick);
    BoundingBoxRender.drawOutlinedBoundingBox(bb, 1.f, 0.2f, 0.2f);
    GL11.glPopMatrix();

    GL11.glDepthMask(true);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java

License:Open Source License

public static void renderNormalVehicleOverlay(VehicleBase vehicle, EntityPlayer player, float partialTick) {
    GL11.glPushMatrix();//from w w w  . j av  a2s.  c  om
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    //  GL11.glDisable(GL11.GL_LIGHTING);
    //  GL11.glDisable(GL11.GL_DEPTH_TEST);
    //GL11.glDepthMask(false);
    GL11.glColor4d(1, 1, 1, 0.6d);

    double x1 = vehicle.posX - player.posX;
    double y1 = vehicle.posY - player.posY;
    double z1 = vehicle.posZ - player.posZ;

    /**
     * vectors for a straight line
     */
    double x2 = x1
            - 20 * Trig.sinDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed());
    double y2 = y1;
    double z2 = z1
            - 20 * Trig.cosDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed());
    GL11.glLineWidth(3f);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3d(x1, y1 + 0.12d, z1);
    GL11.glVertex3d(x2, y2 + 0.12d, z2);
    GL11.glEnd();

    GL11.glLineWidth(4f);
    GL11.glColor4f(1.f, 0.4f, 0.4f, 0.4f);
    GL11.glBegin(GL11.GL_LINES);

    Pos3f offset = vehicle.getMissileOffset();
    x2 = x1 + offset.x;
    y2 = y1 + offset.y;
    z2 = z1 + offset.z;

    double gravity = 9.81d * 0.05d * 0.05d;
    double speed = vehicle.localLaunchPower * 0.05d;
    double angle = 90 - vehicle.localTurretPitch - vehicle.rotationPitch;
    ;
    double yaw = vehicle.localTurretRotation + partialTick * vehicle.moveHelper.getRotationSpeed();

    double vH = -Trig.sinDegrees((float) angle) * speed;
    double vY = Trig.cosDegrees((float) angle) * speed;
    double vX = Trig.sinDegrees((float) yaw) * vH;
    double vZ = Trig.cosDegrees((float) yaw) * vH;

    if (vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR1
            || vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR2) {
        vY += vehicle.motionY;
        vX += vehicle.motionX;
        vZ += vehicle.motionZ;
        y1 = -player.posY;
    }
    while (y2 >= y1) {
        GL11.glVertex3d(x2, y2, z2);
        x2 += vX;
        z2 += vZ;
        y2 += vY;
        vY -= gravity;
        GL11.glVertex3d(x2, y2, z2);
    }
    GL11.glEnd();

    GL11.glPopMatrix();

    GL11.glDepthMask(true);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glColor4d(double a, double b, double c, double d) {
    GL11.glColor4d(a, b, c, d);
}

From source file:tk.wurst_client.features.mods.TrajectoriesMod.java

License:Open Source License

@Override
public void onRender() {
    EntityPlayerSP player = mc.player;// w  w w .  j  av a2s .  c  o  m

    // check if player is holding item
    ItemStack stack = player.inventory.getCurrentItem();
    if (stack == null)
        return;

    // check if item is throwable
    Item item = stack.getItem();
    if (!(item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg
            || item instanceof ItemEnderPearl || item instanceof ItemSplashPotion
            || item instanceof ItemLingeringPotion || item instanceof ItemFishingRod))
        return;

    boolean usingBow = player.inventory.getCurrentItem().getItem() instanceof ItemBow;

    // calculate starting position
    double arrowPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * mc.timer.renderPartialTicks
            - MathHelper.cos((float) Math.toRadians(player.rotationYaw)) * 0.16F;
    double arrowPosY = player.lastTickPosY
            + (player.posY - player.lastTickPosY) * Minecraft.getMinecraft().timer.renderPartialTicks
            + player.getEyeHeight() - 0.1;
    double arrowPosZ = player.lastTickPosZ
            + (player.posZ - player.lastTickPosZ) * Minecraft.getMinecraft().timer.renderPartialTicks
            - MathHelper.sin((float) Math.toRadians(player.rotationYaw)) * 0.16F;

    // calculate starting motion
    float arrowMotionFactor = usingBow ? 1F : 0.4F;
    float yaw = (float) Math.toRadians(player.rotationYaw);
    float pitch = (float) Math.toRadians(player.rotationPitch);
    float arrowMotionX = -MathHelper.sin(yaw) * MathHelper.cos(pitch) * arrowMotionFactor;
    float arrowMotionY = -MathHelper.sin(pitch) * arrowMotionFactor;
    float arrowMotionZ = MathHelper.cos(yaw) * MathHelper.cos(pitch) * arrowMotionFactor;
    double arrowMotion = Math
            .sqrt(arrowMotionX * arrowMotionX + arrowMotionY * arrowMotionY + arrowMotionZ * arrowMotionZ);
    arrowMotionX /= arrowMotion;
    arrowMotionY /= arrowMotion;
    arrowMotionZ /= arrowMotion;
    if (usingBow) {
        float bowPower = (72000 - player.getItemInUseCount()) / 20F;
        bowPower = (bowPower * bowPower + bowPower * 2F) / 3F;

        if (bowPower > 1F)
            bowPower = 1F;

        if (bowPower <= 0.1F)
            bowPower = 1F;

        bowPower *= 3F;
        arrowMotionX *= bowPower;
        arrowMotionY *= bowPower;
        arrowMotionZ *= bowPower;
    } else {
        arrowMotionX *= 1.5D;
        arrowMotionY *= 1.5D;
        arrowMotionZ *= 1.5D;
    }

    // GL settings
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glDisable(2929);
    GL11.glEnable(GL13.GL_MULTISAMPLE);
    GL11.glDepthMask(false);
    GL11.glLineWidth(1.8F);

    RenderManager renderManager = mc.getRenderManager();

    // draw trajectory line
    double gravity = usingBow ? 0.05D
            : item instanceof ItemPotion ? 0.4D : item instanceof ItemFishingRod ? 0.15D : 0.03D;
    Vec3d playerVector = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
    GL11.glColor3d(0, 1, 0);
    GL11.glBegin(GL11.GL_LINE_STRIP);
    for (int i = 0; i < 1000; i++) {
        GL11.glVertex3d(arrowPosX - renderManager.renderPosX, arrowPosY - renderManager.renderPosY,
                arrowPosZ - renderManager.renderPosZ);

        arrowPosX += arrowMotionX * 0.1;
        arrowPosY += arrowMotionY * 0.1;
        arrowPosZ += arrowMotionZ * 0.1;
        arrowMotionX *= 0.999D;
        arrowMotionY *= 0.999D;
        arrowMotionZ *= 0.999D;
        arrowMotionY -= gravity * 0.1;

        if (mc.world.rayTraceBlocks(playerVector, new Vec3d(arrowPosX, arrowPosY, arrowPosZ)) != null)
            break;
    }
    GL11.glEnd();

    // draw end of trajectory line
    double renderX = arrowPosX - renderManager.renderPosX;
    double renderY = arrowPosY - renderManager.renderPosY;
    double renderZ = arrowPosZ - renderManager.renderPosZ;
    AxisAlignedBB bb = new AxisAlignedBB(renderX - 0.5, renderY - 0.5, renderZ - 0.5, renderX + 0.5,
            renderY + 0.5, renderZ + 0.5);
    GL11.glColor4f(0F, 1F, 0F, 0.15F);
    RenderUtils.drawColorBox(bb, 0F, 1F, 0F, 0.15F);
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderUtils.drawSelectionBoundingBox(bb);

    // GL resets
    GL11.glDisable(3042);
    GL11.glEnable(3553);
    GL11.glEnable(2929);
    GL11.glDisable(GL13.GL_MULTISAMPLE);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glPopMatrix();
}

From source file:tk.wurst_client.utils.RenderUtils.java

License:Open Source License

/**
 * Renders an ESP box with the size of a normal block at the specified
 * BlockPos.//from  w w  w .  ja v a2  s.co m
 */
public static void blockEsp(BlockPos blockPos, double red, double green, double blue) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(red, green, blue, 0.15);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), 0F, 0F, 0F, 0F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:tk.wurst_client.utils.RenderUtils.java

License:Open Source License

public static void entityESPBox(Entity entity, int mode) {
    GL11.glBlendFunc(770, 771);/*from   www  .  j  a  va 2  s.  c  o m*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    if (mode == 0)// Enemy
        GL11.glColor4d(1 - Minecraft.getMinecraft().player.getDistanceToEntity(entity) / 40,
                Minecraft.getMinecraft().player.getDistanceToEntity(entity) / 40, 0, 0.5F);
    else if (mode == 1)// Friend
        GL11.glColor4d(0, 0, 1, 0.5F);
    else if (mode == 2)// Other
        GL11.glColor4d(1, 1, 0, 0.5F);
    else if (mode == 3)// Target
        GL11.glColor4d(1, 0, 0, 0.5F);
    else if (mode == 4)// Team
        GL11.glColor4d(0, 1, 0, 0.5F);
    RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
    drawSelectionBoundingBox(new AxisAlignedBB(
            entity.boundingBox.minX - 0.05 - entity.posX + (entity.posX - renderManager.renderPosX),
            entity.boundingBox.minY - entity.posY + (entity.posY - renderManager.renderPosY),
            entity.boundingBox.minZ - 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ),
            entity.boundingBox.maxX + 0.05 - entity.posX + (entity.posX - renderManager.renderPosX),
            entity.boundingBox.maxY + 0.1 - entity.posY + (entity.posY - renderManager.renderPosY),
            entity.boundingBox.maxZ + 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ)));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}