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:vazkii.b_baubles.client.fx.ParticleRenderDispatcher.java

License:Creative Commons License

public static void dispatch() {
    Tessellator tessellator = Tessellator.instance;

    boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
    Profiler profiler = Minecraft.getMinecraft().mcProfiler;

    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);/*from  w  w  w .j  a va  2 s. c o m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    if (isLightingEnabled)
        GL11.glDisable(GL11.GL_LIGHTING);

    profiler.startSection("sparkle");
    FXSparkle.dispatchQueuedRenders(tessellator);
    profiler.endStartSection("wisp");
    FXWisp.dispatchQueuedRenders(tessellator);
    profiler.endSection();

    if (isLightingEnabled)
        GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:vazkii.tinkerer.client.handler.LightningRenderHandler.java

License:Creative Commons License

@ForgeSubscribe
public void onRenderWorldLast(RenderWorldLastEvent event) {
    float frame = event.partialTicks;
    Entity entity = MiscHelper.getClientPlayer();

    interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
    interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
    interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;

    GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ);

    Tessellator tessellator = Tessellator.instance;

    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);/*w  ww  .j  a va 2s .c  o  m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    RenderEngine render = MiscHelper.getMc().renderEngine;

    render.bindTexture(ResourcesReference.LIGHTNING_OUTER_TEXTURE);
    tessellator.startDrawingQuads();
    tessellator.setBrightness(0xF000F0);
    for (LightningBolt bolt : LightningBolt.boltlist)
        renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ,
                ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 0, false);
    tessellator.draw();

    render.bindTexture(ResourcesReference.LIGHTNING_INNER_TEXTURE);
    tessellator.startDrawingQuads();
    tessellator.setBrightness(0xF000F0);
    for (LightningBolt bolt : LightningBolt.boltlist)
        renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ,
                ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 1, true);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

    GL11.glTranslated(interpPosX, interpPosY, interpPosZ);
}

From source file:vazkii.tinkerer.client.helper.RenderHelper.java

License:Creative Commons License

/** Renders a star, similar to the dragon death animation, must be
 * translated previously **//*from www.java 2  s.co m*/
public static void renderStar(int color, float xScale, float yScale, float zScale) {
    Tessellator tessellator = Tessellator.instance;
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();

    int ticks = (int) (ClientTickHandler.elapsedClientTicks % 200);
    if (ticks >= 100)
        ticks = 200 - ticks - 1;

    float f1 = ticks / 200F;
    float f2 = 0.0F;
    if (f1 > 0.7F)
        f2 = (f1 - 0.7F) / 0.2F;
    Random random = new Random(432L);

    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(770, 1);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glTranslatef(0.0F, -1F, -2F);
    GL11.glScalef(xScale, yScale, zScale);
    for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) {
        GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0.0F, 0.0F, 1.0F);
        tessellator.startDrawing(6);
        float f3 = random.nextFloat() * 20F + 5F + f2 * 10F;
        float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
        tessellator.setColorRGBA_I(color, (int) (255F * (1.0F - f2)));
        tessellator.addVertex(0.0D, 0.0D, 0.0D);
        tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0);
        tessellator.addVertex(-0.86599999999999999D * f4, f3, -0.5F * f4);
        tessellator.addVertex(0.86599999999999999D * f4, f3, -0.5F * f4);
        tessellator.addVertex(0.0D, f3, 1.0F * f4);
        tessellator.addVertex(-0.86599999999999999D * f4, f3, -0.5F * f4);
        tessellator.draw();
    }

    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glPopMatrix();
}

From source file:vazkii.tinkerer.client.hud.HudElementVignette.java

License:Creative Commons License

private void renderVignette(int color) {
    Minecraft mc = MiscHelper.getMc();//  w w  w  .  ja  v a 2  s. c o  m
    ScaledResolution var5 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    int par2 = var5.getScaledWidth();
    int par3 = var5.getScaledHeight();

    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR);
    Color colorRGB = new Color(color);
    GL11.glColor4f(colorRGB.getRed(), colorRGB.getGreen(), colorRGB.getBlue(), 1.0F);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture("%blur%/misc/vignette.png"));
    Tessellator var4 = Tessellator.instance;
    var4.startDrawingQuads();
    var4.addVertexWithUV(0.0D, par3, -90.0D, 0.0D, 1.0D);
    var4.addVertexWithUV(par2, par3, -90.0D, 1.0D, 1.0D);
    var4.addVertexWithUV(par2, 0.0D, -90.0D, 1.0D, 0.0D);
    var4.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
    var4.draw();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPopMatrix();
}

From source file:vazkii.tinkerer.client.render.tile.RenderTileTransmutator.java

License:Creative Commons License

private void renderGlyphs(TileEntityTransmutator transmutator) {
    Minecraft mc = MiscHelper.getMc();/*from w ww.j  a v a2s  .c  o  m*/
    mc.renderEngine.bindTexture(LibResources.MISC_GLYPHS);
    GL11.glPushMatrix();
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTranslatef(0.5F, 0.4F, 0.5F);
    float deg = (float) (transmutator.ticksExisted % 360F);
    GL11.glRotatef(deg, 0F, 1F, 0F);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    Tessellator tess = Tessellator.instance;
    tess.startDrawingQuads();
    tess.addVertexWithUV(-0.5, 0, 0.5, 0, 1);
    tess.addVertexWithUV(0.5, 0, 0.5, 1, 1);
    tess.addVertexWithUV(0.5, 0, -0.5, 1, 0);
    tess.addVertexWithUV(-0.5, 0, -0.5, 0, 0);
    tess.draw();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:vazkii.tinkerer.client.render.tile.RenderTileWardChest.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    int meta = tileentity.worldObj == null ? 3 : tileentity.getBlockMetadata();
    int rotation = meta == 2 ? 180 : meta == 3 ? 0 : meta == 4 ? 90 : 270;

    GL11.glPushMatrix();//from w w  w. j  a  v  a2s .c o  m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef((float) x, (float) y, (float) z);

    bindTextureByName(LibResources.MODEL_WARD_CHEST);
    GL11.glTranslatef(0F, 1F, 1F);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    chestModel.chestBelow.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
    chestModel.chestKnob.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);

    GL11.glTranslatef((float) x, (float) y, (float) z);
    renderOverlay((TileEntityWardChest) tileentity);
    GL11.glTranslatef((float) -x, (float) -y, (float) -z);

    bindTextureByName(LibResources.MODEL_WARD_CHEST);
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef((float) x, (float) y, (float) z);

    bindTextureByName(LibResources.MODEL_WARD_CHEST);
    GL11.glTranslatef(0F, 1F, 1F);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    chestModel.chestLid.render(LibMisc.MODEL_DEFAULT_RENDER_SCALE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glPopMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);
}

From source file:wrath.client.graphics.gui.GuiElement.java

License:Open Source License

@Override
public void renderSetup() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);//from  w w w .  jav a2s .  c o m
    GL11.glDisable(GL11.GL_DEPTH_TEST | GL11.GL_BLEND);
    GL11.glDepthMask(false);
    if (texture != null)
        texture.bindTexture();
    GL11.glBegin(GL11.GL_QUADS);
}

From source file:wrath.client.graphics.gui.GuiElement.java

License:Open Source License

@Override
public void renderStop() {
    GL11.glEnd();/*  w  ww  .j a  v  a  2s  .  co m*/
    color.unbindColor();
    Texture.unbindTextures();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}