Example usage for org.lwjgl.opengl GL11 glDepthMask

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

Introduction

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

Prototype

public static void glDepthMask(@NativeType("GLboolean") boolean flag) 

Source Link

Document

Masks the writing of depth values to the depth buffer.

Usage

From source file:mca.client.render.RenderHuman.java

License:Open Source License

/**
 * Renders a label above an entity's head.
 * //www .  j  a  v  a 2 s  .c om
 * @param human The entity that the label should be rendered on.
 * @param labelText The text that should appear on the label.
 */
private void renderLabel(EntityHuman human, double posX, double posY, double posZ, String labelText) {
    if (human.isSneaking()) {
        final Tessellator tessellator = Tessellator.instance;
        final FontRenderer fontRendererObj = getFontRendererFromRenderManager();
        final int stringWidth = fontRendererObj.getStringWidth(labelText) / 2;

        GL11.glPushMatrix();
        {
            GL11.glTranslatef((float) posX + 0.0F, (float) posY + 2.3F, (float) posZ);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(-LABEL_SCALE, -LABEL_SCALE, LABEL_SCALE);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glTranslatef(0.0F, 0.25F / LABEL_SCALE, 0.0F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

            GL11.glDisable(GL11.GL_TEXTURE_2D);

            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
            tessellator.addVertex(-stringWidth - 1, -1D, 0.0D);
            tessellator.addVertex(-stringWidth - 1, 8D, 0.0D);
            tessellator.addVertex(stringWidth + 1, 8D, 0.0D);
            tessellator.addVertex(stringWidth + 1, -1D, 0.0D);
            tessellator.draw();

            GL11.glEnable(GL11.GL_TEXTURE_2D);

            GL11.glDepthMask(true);
            fontRendererObj.drawString(labelText, -fontRendererObj.getStringWidth(labelText) / 2, 0,
                    0x20ffffff);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        }
        GL11.glPopMatrix();
    }

    else {
        //RenderLivingLabel
        func_147906_a(human, labelText, posX, posY, posZ, 64);
    }
}

From source file:mca.client.render.RenderTombstone.java

License:Open Source License

public void renderTombstoneAt(TileTombstone tombstoneEntity, double posX, double posY, double posZ,
        float partialTickTime) {
    final StringBuilder stringBuilder = new StringBuilder();
    final FontRenderer fontRendererObj = func_147498_b();

    final int meta = tombstoneEntity.getBlockMetadata();
    final float rotation = setRotationByMeta(meta);

    GL11.glPushMatrix();//from w w w  .  j a v  a  2s  . c o  m

    GL11.glTranslated(posX + 0.50F, posY + 1.59F, posZ + 0.53F);
    GL11.glRotatef(-rotation, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(0, 0.5F, 0);
    GL11.glScalef(1.4F, 1.4F, 1.4F);

    bindResource(TEXTURE);

    GL11.glPushMatrix();
    {
        GL11.glScalef(1F, -1F, -1F);
        tombstoneModel.renderTombstone();
    }
    GL11.glPopMatrix();

    //Text size is 0.017F.
    GL11.glTranslatef(0.0F, -1.15F, 0.07F);
    GL11.glScalef(0.017F / 2, -0.017F / 2, 0.017F / 2);
    GL11.glNormal3f(0.0F, 0.0F, -1F * 0.017F);
    GL11.glDepthMask(false);

    for (int line = 0; line < tombstoneEntity.signText.length; line++) {
        String lineText = tombstoneEntity.signText[line];

        if (line == tombstoneEntity.lineBeingEdited) {
            lineText = stringBuilder.append("> ").append(lineText).append(" <").toString();
        }

        fontRendererObj.drawString(lineText, -fontRendererObj.getStringWidth(lineText) / 2,
                line * 10 - tombstoneEntity.signText.length * 5, 0x000000);
    }

    GL11.glDepthMask(true);
    GL11.glPopMatrix();
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

/**
 * Renders a box with any size and any color.
 *
 * @param x/*from ww w  .j a v a 2s . c o m*/
 * @param y
 * @param z
 * @param x2
 * @param y2
 * @param z2
 * @param color
 */
public static void box(double x, double y, double z, double x2, double y2, double z2, Color color) {
    x = x - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y = y - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z = z - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    x2 = x2 - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y2 = y2 - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z2 = z2 - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    RenderUtil.setColor(color);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

/**
 * Renders a frame with any size and any color.
 *
 * @param x/* www .  ja va  2 s .  c  o  m*/
 * @param y
 * @param z
 * @param x2
 * @param y2
 * @param z2
 * @param color
 */
public static void frame(double x, double y, double z, double x2, double y2, double z2, Color color) {
    x = x - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y = y - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z = z - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    x2 = x2 - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y2 = y2 - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z2 = z2 - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    RenderUtil.setColor(color);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

/**
 * Renders an ESP box with the size of a normal block at the specified
 * coordinates.//  ww w .  ja  v  a2  s . c  o  m
 *
 * @param x
 * @param y
 * @param z
 */
public static void blockESPBox(BlockPos blockPos) {
    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.glColor4d(0, 1, 0, 0.15F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void framelessBlockESP(BlockPos blockPos, Color color) {
    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);/*from  w ww  . ja  v  a 2s .  c om*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glColor4d(color.getRed() / 255, color.getGreen() / 255, color.getBlue() / 255, 0.15);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(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:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void emptyBlockESPBox(BlockPos blockPos) {
    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);/*w  ww.  j  a  v a2 s  .  com*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void entityESPBox(Entity entity, int mode) {
    GL11.glBlendFunc(770, 771);//from ww  w  .j av a 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().thePlayer.getDistanceToEntity(entity) / 40,
                Minecraft.getMinecraft().thePlayer.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);
    Minecraft.getMinecraft().getRenderManager();
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(
            entity.boundingBox.minX - 0.05 - entity.posX
                    + (entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX),
            entity.boundingBox.minY - entity.posY
                    + (entity.posY - Minecraft.getMinecraft().getRenderManager().renderPosY),
            entity.boundingBox.minZ - 0.05 - entity.posZ
                    + (entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ),
            entity.boundingBox.maxX + 0.05 - entity.posX
                    + (entity.posX - Minecraft.getMinecraft().getRenderManager().renderPosX),
            entity.boundingBox.maxY + 0.1 - entity.posY
                    + (entity.posY - Minecraft.getMinecraft().getRenderManager().renderPosY),
            entity.boundingBox.maxZ + 0.05 - entity.posZ
                    + (entity.posZ - Minecraft.getMinecraft().getRenderManager().renderPosZ)),
            -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void nukerBox(BlockPos blockPos, float damage) {
    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);//from   w ww .  ja  va2s  . com
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glColor4d(damage, 1 - damage, 0, 0.15F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2, z + 0.5 - damage / 2,
            x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2));
    GL11.glColor4d(0, 0, 0, 0.5F);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2,
            z + 0.5 - damage / 2, x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:me.lixko.lixkopack.util.RenderUtils.java

License:Open Source License

public static void searchBox(BlockPos blockPos) {
    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);//from  www  .j  a  v a2 s  . c o m
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    float sinus = 1F - MathHelper
            .abs(MathHelper.sin(Minecraft.getSystemTime() % 10000L / 10000.0F * (float) Math.PI * 4.0F) * 1F);
    GL11.glColor4d(1 - sinus, sinus, 0, 0.15);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glColor4d(0, 0, 0, 0.5);
    RenderGlobal.drawOutlinedBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), -1);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}