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:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

@Override
public void updateViewportAndDepthTest(int x, int y, int w, int h, boolean depthTest) {

    GL11.glViewport(x, y, w, h);//  w  w w.  j a  v a  2s .c om

    if (depthTest) {
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glDepthMask(true);
    } else {
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDepthMask(false);
    }
}

From source file:dan200.qcraft.client.QCraftProxyClient.java

License:Open Source License

private void renderOverlay(ResourceLocation texture, float width, float height) {
    Minecraft mc = Minecraft.getMinecraft();
    GL11.glDisable(GL11.GL_DEPTH_TEST);//from  ww  w. j  av a  2  s .co  m
    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.renderEngine.bindTexture(texture);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0.0D, (double) height, -90.0D, 0.0D, 1.0D);
    tessellator.addVertexWithUV((double) width, (double) height, -90.0D, 1.0D, 1.0D);
    tessellator.addVertexWithUV((double) width, 0.0D, -90.0D, 1.0D, 0.0D);
    tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
    tessellator.draw();
    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);
}

From source file:de.codesourcery.flocking.LWJGLRenderer.java

License:Apache License

private void renderWorld(World world) {
    final double modelMax = world.getSimulationParameters().modelMax;
    xInc = Display.getWidth() / modelMax;
    yInc = Display.getHeight() / modelMax;

    GL11.glEnable(GL11.GL_DEPTH_TEST);//from ww w.  j  a v a 2s  .  c  o m
    GL11.glDepthMask(true);

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(false);

    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);

    final int triangleCount = world.getPopulationCount();

    // setup vertex data       
    final int vertexArrayLen = triangleCount * 3 * 2; // one triangle = 3 vertices * 2 int's per vertex
    final MyIntBuffer vertexBuffer = getVertexBuffer(vertexArrayLen);

    final IntBuffer vertexIntBuffer = vertexBuffer.getBuffer();
    final IBoidVisitor visitor = new IBoidVisitor() {

        @Override
        public void visit(Boid boid) {
            drawBoid(boid, vertexIntBuffer);
        }
    };
    world.visitAllBoids(visitor);

    vertexBuffer.rewind();

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertexBuffer.getHandle());
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertexBuffer.getBuffer(), GL15.GL_DYNAMIC_DRAW);
    GL11.glVertexPointer(2, GL11.GL_INT, 0, 0);

    // setup index data
    MyIntBuffer indexBuffer = getIndexBuffer(triangleCount * 3);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.getHandle());
    GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.getBuffer(), GL15.GL_STATIC_DRAW);

    GL11.glDrawElements(GL11.GL_TRIANGLES, triangleCount * 3, GL11.GL_UNSIGNED_INT, 0);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);

    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);

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

From source file:de.sanandrew.mods.claysoldiers.client.particle.ParticleRenderDispatcher.java

License:Creative Commons License

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

    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);//from  ww w.java  2  s  . c  o  m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
    ParticleNexusFX.dispatchQueuedRenders(tessellator);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:de.sanandrew.mods.enderstuffp.client.render.ItemRendererBiomeDataCrystal.java

License:Creative Commons License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    int biomeId = item.hasTagCompound() ? item.getTagCompound().getShort(ItemBlockBiomeDataCrystal.NBT_BIOME)
            : -1;/*www .j a  v a 2  s  .c o m*/
    int dataProgress = item.hasTagCompound()
            ? item.getTagCompound().getShort(ItemBlockBiomeDataCrystal.NBT_DATAPROG)
            : 0;
    double minCore = 3.0D / 16.0D;
    double maxCore = 13.0D / 16.0D;

    switch (type) {
    case ENTITY:
        GL11.glTranslatef(-0.5F, -0.508F, -0.5F);
        break;
    case INVENTORY:
        GL11.glTranslatef(0.0F, -0.1F, 0.0F);
        break;
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glDepthMask(false);

    if (dataProgress > 0 && biomeId >= 0) {
        double yMax = (10.0D - dataProgress) / 16.0F;
        double tessVMax = dataProgress / 10.0F * 0.5F;
        float[] color = SAPUtils.getRgbaFromColorInt(BiomeGenBase.getBiome(biomeId).color).getColorFloatArray();

        GL11.glColor3f(color[0], color[1], color[2]);
        Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_CORE.getResource());
        SAPClientUtils.drawTexturedSquareYPos(minCore, minCore, maxCore, maxCore, maxCore - yMax, 0.25D, 0.0D,
                0.5D, 0.5D);
        SAPClientUtils.drawTexturedSquareYNeg(minCore, minCore, maxCore, maxCore, minCore, 0.5D, 0.0D, 0.75D,
                0.5D);
        SAPClientUtils.drawTexturedSquareXPos(minCore, minCore, maxCore - yMax, maxCore, maxCore, 0.25D,
                1.0D - tessVMax, 0.5D, 1.0D);
        SAPClientUtils.drawTexturedSquareXNeg(minCore, minCore, maxCore - yMax, maxCore, minCore, 0.75D,
                1.0D - tessVMax, 1.0D, 1.0D);
        SAPClientUtils.drawTexturedSquareZPos(minCore, minCore, maxCore, maxCore - yMax, maxCore, 0.0D,
                1.0D - tessVMax, 0.25D, 1.0D);
        SAPClientUtils.drawTexturedSquareZNeg(minCore, minCore, maxCore, maxCore - yMax, minCore, 0.5D,
                1.0D - tessVMax, 0.75D, 1.0D);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
    }

    minCore -= 0.0001D;
    maxCore += 0.0001D;
    Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.GLASS_TEXTURE);
    SAPClientUtils.drawTexturedSquareYPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareYNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D);

    Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_BLOCKTEXTURE);
    SAPClientUtils.drawTexturedSquareYPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareYNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareXNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D);
    SAPClientUtils.drawTexturedSquareZNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D);

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

From source file:de.sanandrew.mods.turretmod.client.event.RenderFxLayerHandler.java

License:Creative Commons License

@SubscribeEvent
public void onRenderFxPre(SAPFxLayerRenderEvent.Pre event) {
    if (event.layerId == ClientProxy.particleFxLayer1) {
        GL11.glDepthMask(false);
    }
}

From source file:de.sanandrew.mods.turretmod.client.event.RenderFxLayerHandler.java

License:Creative Commons License

@SubscribeEvent
public void onRenderFxPost(SAPFxLayerRenderEvent.Post event) {
    if (event.layerId == ClientProxy.particleFxLayer1) {
        GL11.glDepthMask(true);
    }
}

From source file:de.sanandrew.mods.turretmod.client.render.entity.RenderTurret.java

License:Creative Commons License

private int renderGlowMap(EntityTurretBase turret, int pass) {
    if (pass == 0) {
        this.setRenderPassModel(this.glowModel);
        this.bindTexture(turret.getGlowTexture());

        GL11.glEnable(GL11.GL_BLEND);/*from   www  .j a va  2 s . c o m*/
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

        int bright = 0xF0;
        int brightX = bright % 65536;
        int brightY = bright / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDepthMask(false);

        return 1;
    } else if (pass == 1) {
        this.setRenderPassModel(this.mainModel);
        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_BLEND);
    }

    return -1;
}

From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java

License:Creative Commons License

private static void setupTooltipRenderer(Minecraft mc, TileEntityItemTransmitter te, float partTicks) {
    double playerPTX = mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * partTicks;
    double playerPTZ = mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * partTicks;
    Vec3 vecPos = Vec3.createVectorHelper(playerPTX - (te.xCoord + 0.5D), 0.0, playerPTZ - (te.zCoord + 0.5D));
    vecPos = vecPos.normalize();//from  www  .  j av  a2  s . com
    double angle = Math.toDegrees(Math.atan2(vecPos.zCoord, vecPos.xCoord));

    GL11.glDepthMask(false);
    GL11.glRotated(90, 0.0F, 1.0F, 0.0F);
    GL11.glRotated(angle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslated(0.0F, -0.25F, 0.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    GL11.glColor4d(1.0D, 1.0D, 1.0D, 0.75D + (float) SAPUtils.RNG.nextGaussian() * 0.02F);
}

From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java

License:Creative Commons License

private static void finishTooltipRenderer() {
    GL11.glDepthMask(true);
    GL11.glColor4d(1.0D, 1.0D, 1.0D, 1.0D);
    GL11.glEnable(GL11.GL_LIGHTING);
}