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:rheel.ac.client.gui.GuiResearch.java

License:Open Source License

private void drawResearchGlass(Minecraft mc, int xStart, int yStart, int mouseX, int mouseY) {
    GL11.glPushMatrix();//from www.  j a va 2 s . co  m
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_ALPHA_TEST);

    mc.getTextureManager().bindTexture(TextureLoader.getGUITexture("Research.png"));
    this.drawTexturedModalRect(xStart + this.researchX, yStart + this.researchY, 46, 131, 40, 26);

    GL11.glPopMatrix();
}

From source file:rheel.ac.common.handler.TickHandlerRadiationOverlay.java

License:Open Source License

@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
    if (type.contains(TickType.RENDER) && FMLCommonHandler.instance().getEffectiveSide().isClient()) {
        final Minecraft mc = Minecraft.getMinecraft();

        if (mc.thePlayer != null && mc.thePlayer.isPotionActive(Potions.potionRadioActive.id)
                && mc.currentScreen == null) {
            GL11.glPushMatrix();//from   w w w .  j  a v a2  s.co  m
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(false);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.294F);
            GL11.glDisable(GL11.GL_ALPHA_TEST);

            mc.getTextureManager().bindTexture(TextureLoader.getGUITexture("RadioActiveBlur.png"));

            final Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(0.0D, mc.displayHeight, -90.0D, 0.0D, 1.0D);
            tessellator.addVertexWithUV(mc.displayWidth, mc.displayHeight, -90.0D, 1.0D, 1.0D);
            tessellator.addVertexWithUV(mc.displayWidth, 0.0D, -90.0D, 1.0D, 0.0D);
            tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
            tessellator.draw();

            GL11.glPopMatrix();
        }
    }
}

From source file:rtype.Prototyp.java

License:Open Source License

private void initGL() {

    GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
    GL11.glClearDepth(1.0f); // Depth Buffer Setup
    GL11.glDisable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glEnable(GL11.GL_BLEND);//from  w w  w .jav a 2  s  .co m
    GL11.glDepthMask(false);
    GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
    GL11.glLoadIdentity(); // Reset The Projection Matrix

    GLU.gluOrtho2D(-(int) SCREEN_WIDTH / 2, (int) SCREEN_WIDTH / 2, (int) -SCREEN_HEIGHT / 2,
            (int) SCREEN_HEIGHT / 2);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    if (useDevil)
        ;//textureLoader = new DevilTextureLoader();
    else {
        textureLoader = new WorkAroundTextureLoader();
    }
    textureLoader.init();
}

From source file:ru.ulmc.extender.gui.SurvivalGui.java

License:Open Source License

private void doRenderWork(ResourceLocation action) {
    ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    int xPos = scaledresolution.getScaledWidth();
    int yPos = scaledresolution.getScaledHeight();
    int color = 0xfefefe;
    Minecraft.getMinecraft().renderEngine.bindTexture(action);
    GL11.glDisable(GL11.GL_DEPTH_TEST);/*from  w  w  w .  j  a va  2 s.  c  o m*/
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, power);
    //GL11.glDisable(GL11.GL_ALPHA_TEST);

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0.0D, (double) yPos, -90.0D, 0.0D, 1.0D);
    tessellator.addVertexWithUV((double) xPos, (double) yPos, -90.0D, 1.0D, 1.0D);
    tessellator.addVertexWithUV((double) xPos, 0.0D, -90.0D, 1.0D, 0.0D);
    tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
    tessellator.draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    //GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    /*FontRenderer fontRender = mc.fontRenderer;
    fontRender.drawStringWithShadow("Delta: " + Math.round(currentMaxPower * 100),xPos-relativeX,absoluteY,color);*/
}

From source file:ru.ulmc.extender.render.particle.EntityLockFX.java

License:Open Source License

@Override
public void renderParticle(Tessellator tess, float partialTicks, float par3, float par4, float par5, float par6,
        float par7) {
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);//from   ww w  .  j  a  va 2 s  .  c o  m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    tess.startDrawingQuads();
    tess.setBrightness(getBrightnessForRender(partialTicks));
    float scale = 0.2F * particleScale;
    float x = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
    float y = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
    float z = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
    float f14 = 1.0F;
    tess.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14,
            this.particleAlpha);
    tess.addVertexWithUV(x - par3 * scale - par6 * scale, y - par4 * scale, z - par5 * scale - par7 * scale,
            0.0, 0.0);
    tess.addVertexWithUV(x - par3 * scale + par6 * scale, y + par4 * scale, z - par5 * scale + par7 * scale,
            1.0, 0.0);
    tess.addVertexWithUV(x + par3 * scale + par6 * scale, y + par4 * scale, z + par5 * scale + par7 * scale,
            1.0, 1.0);
    tess.addVertexWithUV(x + par3 * scale - par6 * scale, y - par4 * scale, z + par5 * scale - par7 * scale,
            0.0, 1.0);
    tess.draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    //UltimateExtender.logger.info("render at:" + partialTicks);
}

From source file:ru.ulmc.extender.render.particle.EntityTestFX.java

License:Open Source License

@Override
public void renderParticle(Tessellator tess, float partialTicks, float par3, float par4, float par5, float par6,
        float par7) {
    Minecraft.getMinecraft().renderEngine.bindTexture(texture);

    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);//w ww  .j  a  va2s . co m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);

    tess.startDrawingQuads();
    tess.setBrightness(getBrightnessForRender(partialTicks));
    float scale = 0.2F * particleScale;
    float x = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
    float y = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
    float z = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
    float f14 = 1.0F;
    //tess.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
    tess.addVertexWithUV(x + par3 * scale + par6 * scale, y + par4 * scale, z + par5 * scale + par7 * scale,
            0.0, 0.0);
    tess.addVertexWithUV(x + par3 * scale - par6 * scale, y - par4 * scale, z + par5 * scale - par7 * scale,
            0.0, 1.0);
    tess.addVertexWithUV(x - par3 * scale - par6 * scale, y - par4 * scale, z - par5 * scale - par7 * scale,
            1.0, 1.0);
    tess.addVertexWithUV(x - par3 * scale + par6 * scale, y + par4 * scale, z - par5 * scale + par7 * scale,
            1.0, 0.0);
    tess.draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    //UltimateExtender.logger.info("render at:" + partialTicks);
}

From source file:runes.Runes.CustomEffectRenderer.java

License:Open Source License

/**
 * Renders all current particles. Args player, partialTickTime
 *///  ww  w . j a  v a2  s.co m
public void renderParticles(Entity par1Entity, float par2) {
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = par1Entity.lastTickPosX + (par1Entity.posX - par1Entity.lastTickPosX) * (double) par2;
    EntityFX.interpPosY = par1Entity.lastTickPosY + (par1Entity.posY - par1Entity.lastTickPosY) * (double) par2;
    EntityFX.interpPosZ = par1Entity.lastTickPosZ + (par1Entity.posZ - par1Entity.lastTickPosZ) * (double) par2;

    for (int i = 0; i < 3; ++i) {
        if (!this.fxLayers[i].isEmpty()) {
            switch (i) {
            case 0:
            default:
                this.renderer.bindTexture(particleTextures);
                break;
            case 1:
                this.renderer.bindTexture(TextureMap.locationBlocksTexture);
                break;
            case 2:
                this.renderer.bindTexture(TextureMap.locationItemsTexture);
            }

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
            Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();

            for (int j = 0; j < this.fxLayers[i].size(); ++j) {
                EntityFX entityfx = (EntityFX) this.fxLayers[i].get(j);
                if (entityfx == null)
                    continue;
                tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
                entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4);
            }

            tessellator.draw();
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);
            GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        }
    }
}

From source file:shadowmage.ancient_framework.client.render.RenderTools.java

License:Open Source License

/**
 * draw a player-position-normalized bounding box (can only be called during worldRender)
 * @param bb/*from   www .  j  a v a2  s.  co  m*/
 */
public static void drawOutlinedBoundingBox(AxisAlignedBB bb, float r, float g, float b) {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(r, g, b, 0.4F);
    GL11.glLineWidth(8.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(3);
    tess.addVertex(bb.minX, bb.minY, bb.minZ);
    tess.addVertex(bb.maxX, bb.minY, bb.minZ);
    tess.addVertex(bb.maxX, bb.minY, bb.maxZ);
    tess.addVertex(bb.minX, bb.minY, bb.maxZ);
    tess.addVertex(bb.minX, bb.minY, bb.minZ);
    tess.draw();
    tess.startDrawing(3);
    tess.addVertex(bb.minX, bb.maxY, bb.minZ);
    tess.addVertex(bb.maxX, bb.maxY, bb.minZ);
    tess.addVertex(bb.maxX, bb.maxY, bb.maxZ);
    tess.addVertex(bb.minX, bb.maxY, bb.maxZ);
    tess.addVertex(bb.minX, bb.maxY, bb.minZ);
    tess.draw();
    tess.startDrawing(1);
    tess.addVertex(bb.minX, bb.minY, bb.minZ);
    tess.addVertex(bb.minX, bb.maxY, bb.minZ);
    tess.addVertex(bb.maxX, bb.minY, bb.minZ);
    tess.addVertex(bb.maxX, bb.maxY, bb.minZ);
    tess.addVertex(bb.maxX, bb.minY, bb.maxZ);
    tess.addVertex(bb.maxX, bb.maxY, bb.maxZ);
    tess.addVertex(bb.minX, bb.minY, bb.maxZ);
    tess.addVertex(bb.minX, bb.maxY, bb.maxZ);
    tess.draw();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}

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

License:Open Source License

/**
 * shamelessly copied to enable color-differentiation per-entity
 *//*from w  w  w  . j av a 2s . co m*/
@Override
protected void renderLivingLabel(EntityLivingBase par1EntityLiving, String par2Str, double renderX,
        double renderY, double renderZ, int renderDistance) {
    double var10 = par1EntityLiving.getDistanceSqToEntity(this.renderManager.livingPlayer);
    if (var10 <= (double) (renderDistance * renderDistance)) {
        NpcBase npc = (NpcBase) par1EntityLiving;
        boolean hostile = TeamTracker.instance().isHostileTowards(npc.worldObj, npc.teamNum,
                TeamTracker.instance().getTeamForPlayer(Minecraft.getMinecraft().thePlayer));
        if (hostile && !Config.renderHostileNames) {
            return;
        }
        FontRenderer fontRenderer = this.getFontRendererFromRenderManager();
        float var13 = 1.6F;
        float var14 = 0.016666668F * var13;
        GL11.glPushMatrix();
        GL11.glTranslatef((float) renderX, (float) renderY + 2.3F, (float) renderZ);
        GL11.glNormal3f(0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(-var14, -var14, var14);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthMask(false);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        Tessellator tessellator = Tessellator.instance;
        byte yOffset = 0;// Y offset

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        tessellator.startDrawingQuads();
        int xOffset = fontRenderer.getStringWidth(par2Str) / 2;// 
        tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
        tessellator.addVertex((double) (-xOffset - 1), (double) (-1 + yOffset), 0.0D);
        tessellator.addVertex((double) (-xOffset - 1), (double) (8 + yOffset), 0.0D);
        tessellator.addVertex((double) (xOffset + 1), (double) (8 + yOffset), 0.0D);
        tessellator.addVertex((double) (xOffset + 1), (double) (-1 + yOffset), 0.0D);
        tessellator.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        int color = 553648127;
        int color2 = -1;
        if (hostile) {
            color = 0xffff0000;
            color2 = 0xffff0000;
        }
        fontRenderer.drawString(par2Str, -fontRenderer.getStringWidth(par2Str) / 2, yOffset, color);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        fontRenderer.drawString(par2Str, -fontRenderer.getStringWidth(par2Str) / 2, yOffset, color2);//was-1
        if (!hostile && Settings.getRenderNpcObjectives()) {
            renderObjectiveIcon(npc.getAIObjectiveID());
            renderTaskIcon(npc.getAITaskID());
            //      renderErrorIcon(npc.getAIErrorID());
        }
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }
}

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  v  a  2  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);

    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);
}