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: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  w w . j a  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);

    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();//from  w  w w. j a va  2  s  . c o 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.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();//  ww w.  j a  v  a 2s .  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:shadowmage.ancient_warfare.client.render.RenderVehicleHelper.java

License:Open Source License

private void renderNamePlate(VehicleBase vehicle, double par3, double par5, double par7, float yaw,
        float tick) {
    double var10 = vehicle.getDistanceSqToEntity(this.renderManager.livingPlayer);
    int par9 = 64;
    String par2Str = vehicle.vehicleType.getLocalizedName() + " " + formatter1d.format(vehicle.getHealth())
            + "/" + formatter1d.format(vehicle.baseHealth);
    if (var10 <= (double) (par9 * par9)) {
        FontRenderer var12 = this.getFontRendererFromRenderManager();
        float var13 = 1.6F;
        float var14 = 0.016666668F * var13;
        float namePlateHeight = vehicle.height + 0.75f;
        GL11.glPushMatrix();/*from w w w  . ja  va2  s  . c  om*/
        GL11.glTranslatef((float) par3 + 0.0F, (float) par5 + namePlateHeight, (float) par7);
        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 var15 = Tessellator.instance;
        byte var16 = 0;
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        var15.startDrawingQuads();
        int var17 = var12.getStringWidth(par2Str) / 2;
        var15.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
        var15.addVertex((double) (-var17 - 1), (double) (-1 + var16), 0.0D);
        var15.addVertex((double) (-var17 - 1), (double) (8 + var16), 0.0D);
        var15.addVertex((double) (var17 + 1), (double) (8 + var16), 0.0D);
        var15.addVertex((double) (var17 + 1), (double) (-1 + var16), 0.0D);
        var15.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, 553648127);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(true);
        var12.drawString(par2Str, -var12.getStringWidth(par2Str) / 2, var16, -1);
        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.vehicle.RenderSubmarine.java

License:Open Source License

@Override
public void renderVehicle(VehicleBase veh, double x, double y, double z, float yaw, float tick) {
    float wheelAngle = veh.wheelRotation + (tick * (veh.wheelRotation - veh.wheelRotationPrev));
    model.setWheelRotations(wheelAngle, wheelAngle, wheelAngle, wheelAngle);
    model.render(veh, 0, 0, 0, 0, 0, 0.0625f);
    GL11.glEnable(GL11.GL_BLEND);//from   ww  w .j av  a2s  .  c o m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    AWTextureManager.bindTexture(Config.texturePath + "models/submarine_screen.png");
    model.render(veh, 0, 0, 0, 0, 0, 0.0625f);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
    AWTextureManager.bindTexture(veh.getTexture());
}

From source file:sokobanMod.client.HandlerLevelPreviewRenderer.java

License:LGPL

private void renderPreview(DrawBlockHighlightEvent event) {

    double x = event.target.blockX + 0.5F;
    double y = event.target.blockY + 0.5F;
    double z = event.target.blockZ + 0.5F;
    double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
    double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
    double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;

    int baseX = event.target.blockX;
    int baseY = event.target.blockY + 1;
    int baseZ = event.target.blockZ;

    float xScale = 0.1F;
    float yScale = 0.1F;
    float zScale = 0.1F;
    float xShift = 0.0F;
    float yShift = 1.0F;
    float zShift = 0.0F;
    // determine the line color

    int[] levelBounds;
    int[] rawLevelBounds;
    ForgeDirection sideHit = ForgeDirection.UP;
    if (event.currentItem == new ItemStack(SokobanMod.ItemLevelGeneratorTutorial)) {
        rawLevelBounds = LevelRegistrator.getLevelBounds(event.currentItem.getItemDamage());
        levelBounds = rawLevelBounds.clone();
        levelBounds[0]++;//ww  w .  j  a  v  a 2 s  .  c  om
        levelBounds[1]++;
        levelBounds[2]++;
        yShift += levelBounds[1] / 2;

        int orientation = SokobanUtils.determineOrientation(event.player);
        switch (orientation) {
        case 0:
            orientation = 3;
            break;
        case 3:
            orientation = 5;
            break;
        case 1:
            orientation = 4;
            break;
        }
        sideHit = ForgeDirection.getOrientation(orientation);

        xShift += (1 - levelBounds[0] % 2) / 2F;
        yShift -= (1 - levelBounds[1] % 2) / 2F;
        zShift += (1 - levelBounds[2] % 2) / 2F;

    } else {
        colliding = false; // always render the wireframe green.
        NBTTagCompound nbt = event.player.getCurrentEquippedItem().stackTagCompound;
        if (nbt != null && nbt.hasKey("x")) {
            int startX = nbt.getInteger("x");
            int startY = nbt.getInteger("y");
            int startZ = nbt.getInteger("z");
            int endX = event.target.blockX;
            int endY = event.target.blockY;
            int endZ = event.target.blockZ;

            rawLevelBounds = new int[] { Math.abs(endX - startX), Math.abs(endY - startY),
                    Math.abs(endZ - startZ) };
            levelBounds = new int[] { rawLevelBounds[0] + 1, rawLevelBounds[1] + 1, rawLevelBounds[2] + 1 };

            xShift -= (endX - startX) / 2F;
            yShift -= (endY - startY) / 2F + 1F;
            zShift -= (endZ - startZ) / 2F;
        } else {
            rawLevelBounds = new int[] { 1, 1, 1 };
            levelBounds = new int[] { 1, 1, 1 };
            yShift = 0F;
        }

    }
    switch (sideHit) {
    case NORTH:
        zShift += levelBounds[2] / 2;
        zShift -= 1 - levelBounds[2] % 2;
        zShift = -zShift;

        baseZ -= rawLevelBounds[2];// +2
        baseX -= rawLevelBounds[0] / 2;
        break;
    case SOUTH:
        zShift += levelBounds[2] / 2;
        zShift -= 1 - levelBounds[2] % 2;

        baseX -= rawLevelBounds[0] / 2;
        break;
    case EAST:
        // zShift = 0;
        xShift += levelBounds[0] / 2;
        xShift -= 1 - levelBounds[0] % 2;
        baseZ -= rawLevelBounds[2] / 2;
        break;
    case WEST:
        xShift += levelBounds[0] / 2;
        xShift -= 1 - levelBounds[0] % 2;
        xShift = -xShift;

        baseX -= rawLevelBounds[0];
        baseZ -= rawLevelBounds[2] / 2;
        break;
    default:
    }

    colliding = SokobanUtils.isCollidingWithLevel(event.player.worldObj, baseX, baseY, baseZ,
            baseX + rawLevelBounds[0], baseY + rawLevelBounds[1], baseZ + rawLevelBounds[2]);

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    // GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 0; i < 6; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(levelBounds[0] + xScale, levelBounds[1] + yScale, levelBounds[2] + zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        renderPulsingQuad();
        GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);

}

From source file:sophisticated_wolves.RenderSophisticatedWolf.java

License:LGPL

public void renderWolfName(EntitySophisticatedWolf wolf, double d, double d1, double d2) {
    float f = 1.6F;
    float f1 = 0.01666667F * f;
    float f2 = wolf.getDistanceToEntity(this.renderManager.livingPlayer);
    float f3 = wolf.isSitting() ? 32 : 64;
    if (f2 < f3) {
        String wolfName = wolf.getCustomNameTag();
        FontRenderer fontRenderer = this.getFontRendererFromRenderManager();
        GL11.glPushMatrix();/*  www.  j av  a2 s.c  o  m*/
        GL11.glTranslatef((float) d, (float) d1 + 1.5F, (float) d2);
        GL11.glNormal3f(0, 1, 0);
        GL11.glRotatef(-this.renderManager.playerViewY, 0, 1, 0);
        GL11.glRotatef(this.renderManager.playerViewX, 1, 0, 0);
        GL11.glScalef(-f1, -f1, f1);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glTranslatef(0, 0.25F / f1, 0);
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        worldRenderer.startDrawingQuads();
        int var16 = fontRenderer.getStringWidth(wolfName) / 2;
        worldRenderer.setColorRGBA_F(0, 0, 0, 0.25F);
        worldRenderer.addVertex(-var16 - 1, -1, 0);
        worldRenderer.addVertex(-var16 - 1, 8, 0);
        worldRenderer.addVertex(var16 + 1, 8, 0);
        worldRenderer.addVertex(var16 + 1, -1, 0);
        tessellator.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        if (!wolf.isSitting()) {
            fontRenderer.drawString(wolfName, -fontRenderer.getStringWidth(wolfName) / 2, 0,
                    getSitNameColor(wolf));
            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(true);
            fontRenderer.drawString(wolfName, -fontRenderer.getStringWidth(wolfName) / 2, 0,
                    getWolfNameColor(wolf));
        } else {
            GL11.glDepthMask(true);
            fontRenderer.drawString(wolfName, -fontRenderer.getStringWidth(wolfName) / 2, 0,
                    getSitNameColor(wolf));
        }
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glPopMatrix();
    }
}

From source file:sqr.client.render.RenderFakePlayer.java

License:Open Source License

protected void renderLivingLabel(Entity entity, String text, double posX, double posY, double posZ,
        int visibleDistance) {
    final double distanceSq = entity.getDistanceSqToEntity(renderManager.livingPlayer);

    if (distanceSq <= visibleDistance * visibleDistance) {
        final EntityFakePlayer fakePlayer = (EntityFakePlayer) entity;
        final FontRenderer fontRenderer = getFontRendererFromRenderManager();
        final float labelScale = 0.0268F;

        GL11.glPushMatrix();//from   www .  j  a v a  2s  .  c  o  m
        {
            GL11.glTranslatef((float) posX + 0.0F, (float) posY + entity.height + 0.5F, (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(-labelScale, -labelScale, labelScale);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glDepthMask(false);
            GL11.glDisable(GL11.GL_DEPTH_TEST);
            GL11.glEnable(GL11.GL_BLEND);

            OpenGlHelper.glBlendFunc(770, 771, 1, 0);

            GL11.glDisable(GL11.GL_TEXTURE_2D);

            final Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);

            final int halfStringWidth = fontRenderer.getStringWidth(text) / 2;
            tessellator.addVertex(-halfStringWidth - 1, -1, 0.0D);
            tessellator.addVertex(-halfStringWidth - 1, 8, 0.0D);
            tessellator.addVertex(halfStringWidth + 1, 8, 0.0D);
            tessellator.addVertex(halfStringWidth + 1, -1, 0.0D);
            tessellator.draw();

            GL11.glEnable(GL11.GL_TEXTURE_2D);
            fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, 0, 553648127);

            GL11.glEnable(GL11.GL_DEPTH_TEST);
            GL11.glDepthMask(true);

            if (fakePlayer.isContributor) {
                fontRenderer.drawString(Color.YELLOW + Format.ITALIC + text,
                        -fontRenderer.getStringWidth(text) / 2, 0, -1);
            }

            else {
                fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, 0, -1);
            }

            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:src.graphics.common.Rendering.java

License:Open Source License

/**  A generalised interface for stuff that wants to be rendered-
  *//* w  ww . j a  v  a2s  . c  om*/
void initSettings() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL11.glEnable(GL11.GL_NORMALIZE); //  IF MISSING, COLOURS ARE TOO BRIGHT.
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);

    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE);
}

From source file:src.graphics.sfx.MoteFX.java

License:Open Source License

public void renderTo(Rendering rendering) {
    mote.matchTo(this);
    mote.position.z -= 0.5f;/*  w  w  w  . ja  va 2s.c om*/
    mote.setAnimation("animation", progress);
    mote.update();
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    mote.renderTo(rendering);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
}