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:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glDepthMask(boolean flag) {
    GL11.glDepthMask(flag);
}

From source file:com.blogspot.jabelarminecraft.magicbeans.renderers.RenderMysteriousStranger.java

License:Open Source License

@Override
public void passSpecialRender(EntityLivingBase parEntity, double parX, double parY, double parZ) {
    super.passSpecialRender(parEntity, parX, parY, parZ);
    if (parEntity.ticksExisted < 20 * 2) {
        GL11.glPushMatrix();//from www  .  j a va2s  .  c o  m
        GL11.glTranslated(parX, parY + parEntity.height / 2, parZ);
        GL11.glScalef(3.0F, 3.0F, 3.0F);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDepthMask(false);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, (40.0F - parEntity.ticksExisted) / 40.0F);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glCallList(ClientProxy.sphereIdOutside);
        GL11.glCallList(ClientProxy.sphereIdInside);
        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.client.render.RenderLamp.java

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();//w w  w . j  av  a  2s. c o  m
    {
        switch (type) {
        case ENTITY:
            GL11.glTranslated(-0.5, -0.5, -0.5);
            break;
        case EQUIPPED:
            break;
        case EQUIPPED_FIRST_PERSON:
            GL11.glTranslated(0, -0.1, 0);
            break;
        case INVENTORY:
            GL11.glTranslated(0, -0.1, 0);
            break;
        default:
            break;
        }

        BlockLamp block = (BlockLamp) Block.getBlockFromItem(item.getItem());
        int redMask = 0xFF0000, greenMask = 0xFF00, blueMask = 0xFF;
        int r = (block.getColor() & redMask) >> 16;
        int g = (block.getColor() & greenMask) >> 8;
        int b = (block.getColor() & blueMask);

        Vec3dCube cube = new Vec3dCube(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);

        Tessellator t = Tessellator.instance;
        t.startDrawingQuads();
        t.setColorOpaque(r, g, b);

        RenderHelper h = RenderHelper.instance;
        h.reset();
        h.setColor(block.getColor());
        h.renderBox(cube, block.isInverted() ? BlockLamp.on : BlockLamp.off);
        h.reset();

        t.draw();
        if (block.isInverted()) {
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
            // GL11.glAlphaFunc(GL11.GL_EQUAL, (power / 15F) * 1F);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_LIGHTING);
            // GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glDepthMask(false);
            GL11.glBegin(GL11.GL_QUADS);
            com.bluepowermod.client.render.RenderHelper.drawColoredCube(cube.clone().expand(0.8 / 16D),
                    r / 256D, g / 256D, b / 256D, 0.625D);
            GL11.glEnd();
            GL11.glDepthMask(true);
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    GL11.glPopMatrix();
}

From source file:com.builtbroken.assemblyline.content.rail.carts.RenderCart.java

/**
 * Renders the bounding box around the cart
 *
 * @param cart/*from ww  w.ja va2s  .  c o m*/
 * @param xx
 * @param yy
 * @param zz
 */
protected void drawBounds(EntityAbstractCart cart, double xx, double yy, double zz) {
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    float halfWidth = cart.width / 2.0F;
    float halfLength = cart.length / 2.0F;
    float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw));
    if (yaw >= 45 && yaw <= 135) {
        halfWidth = cart.length / 2.0F;
        halfLength = cart.width / 2.0F;
    }

    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(xx - halfWidth, yy, zz - halfLength,
            xx + halfWidth, yy + (double) cart.height, zz + halfLength);
    RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:com.builtbroken.atomic.content.items.cell.RendererItemCell.java

protected void renderFluid(ItemRenderType type, ItemStack item) {
    final FluidStack fluidStack = ((ItemFluidCell) item.getItem()).getFluid(item);
    if (fluidStack != null) {
        final Fluid fluid = fluidStack.getFluid();

        if (fluid != null) {
            final IIcon maskIcon = ASItems.itemFluidCell.getIconFromDamage(-1);
            final IIcon subIcon = fluid.getFlowingIcon() != null ? fluid.getFlowingIcon() : fluid.getIcon();

            if (maskIcon != null && subIcon != null) {
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                GL11.glDisable(GL11.GL_CULL_FACE);
                Tessellator tessellator = Tessellator.instance;

                //Render mask TODO change mask verts to show fill %
                bindItemTexture(item.getItem());
                tessellator.startDrawingQuads();
                tessellator.setNormal(0, 0, 1);
                generatedGeometry(maskIcon, type, 10, 0.001);
                tessellator.draw();/*from   w w w .  j  a v a 2  s  . com*/

                tessellator.startDrawingQuads();
                tessellator.setNormal(0, 0, -1); //TODO don't think is needed for inventory
                generatedGeometry(maskIcon, type, -0.0635, -0.0635);
                tessellator.draw();

                //Render fluid
                bindFluidTexture(fluid);

                GL11.glDepthFunc(GL11.GL_EQUAL);
                GL11.glDepthMask(false);

                tessellator.startDrawingQuads();
                tessellator.setNormal(0, 0, 1);
                generatedGeometry(subIcon, type, 10, 0.001);
                tessellator.draw();

                tessellator.startDrawingQuads();
                tessellator.setNormal(0, 0, -1); //TODO don't think is needed for inventory
                generatedGeometry(subIcon, type, -0.0635, -0.0635);
                tessellator.draw();

                GL11.glDisable(GL11.GL_BLEND);
                GL11.glDepthMask(true);
                GL11.glDepthFunc(GL11.GL_LEQUAL);
                GL11.glEnable(GL11.GL_CULL_FACE);
                GL11.glColor4f(1, 1, 1, 1);
            }
        }
    }
}

From source file:com.builtbroken.icbm.content.rail.RenderMissileCart.java

/**
 * Renders the bounding box around the cart
 *
 * @param cart/*w  w  w.  j  a va 2s. co  m*/
 * @param xx
 * @param yy
 * @param zz
 */
protected void drawBounds(EntityMissileCart cart, double xx, double yy, double zz) {
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    float halfWidth = cart.width / 2.0F;
    float halfLength = cart.length / 2.0F;
    float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw));
    if (yaw >= 45 && yaw <= 135) {
        halfWidth = cart.length / 2.0F;
        halfLength = cart.width / 2.0F;
    }

    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(xx - halfWidth, yy, zz - halfLength,
            xx + halfWidth, yy + (double) cart.height, zz + halfLength);
    RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

/**
 * Renders a box with any size and any color.
 *
 * @param x/*w w w.  ja v  a2  s.c om*/
 * @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, float red, float green,
        float blue, float alpha) {
    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);
    GL11.glDepthMask(false);
    GL11.glColor4f(red, green, blue, alpha);
    drawColorBox(new AxisAlignedBB(x, y, z, x2, y2, z2), red, green, blue, alpha);
    GL11.glColor4d(0, 0, 0, 0.5F);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

/**
 * Renders a frame with any size and any color.
 *
 * @param x/*  w w w  .j a 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);
    setColor(color);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

/**
 * Renders an ESP box with the size of a normal block at the specified
 * BlockPos./* ww w. ja  v  a 2s.c  o m*/
 */
public static void blockEsp(BlockPos blockPos, Color c, double length, double length2) {
    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.glPushMatrix();
    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);
    GL11.glColor4d(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 0.15);
    drawColorBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length), 0F, 0F, 0F, 0F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length));
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
    GL11.glPopMatrix();
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void blockEspFrame(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);//from  w  w  w.  ja v  a  2s. c  o  m
    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.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);
}