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.shinoow.abyssalcraft.client.render.entity.RenderAntiSpider.java

License:Apache License

protected int shouldRenderPass(EntityAntiSpider par1EntityAntiSpider, int par2, float par3) {
    if (par2 != 0)
        return -1;
    else {/* ww  w. j a  v a2 s. c o m*/
        bindTexture(spiderEyesTextures);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

        if (par1EntityAntiSpider.isInvisible())
            GL11.glDepthMask(false);
        else
            GL11.glDepthMask(true);

        char c0 = 61680;
        int j = c0 % 65536;
        int k = c0 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        return 1;
    }
}

From source file:com.shinoow.abyssalcraft.client.render.entity.RenderDragonBoss.java

License:Apache License

/**
 * Renders the animation for when an enderdragon dies
 *//*from   www  . jav a 2s . co  m*/
protected void renderDragonDying(EntityDragonBoss par1entitydragonboss, float par2) {
    super.renderEquippedItems(par1entitydragonboss, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1entitydragonboss.deathTicks > 0) {
        RenderHelper.disableStandardItemLighting();
        float f1 = (par1entitydragonboss.deathTicks + par2) / 200.0F;
        float f2 = 0.0F;

        if (f1 > 0.8F)
            f2 = (f1 - 0.8F) / 0.2F;

        Random random = new Random(432L);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDepthMask(false);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, -1.0F, -2.0F);

        for (int i = 0; i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) {
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
            float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
            tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2)));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(16711935, 0);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
            tessellator.addVertex(0.0D, f3, 1.0F * f4);
            tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
            tessellator.draw();
        }

        GL11.glPopMatrix();
        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);
        RenderHelper.enableStandardItemLighting();
    }
}

From source file:com.shinoow.abyssalcraft.common.items.armor.ItemDepthsArmor.java

License:Apache License

@Override
@SideOnly(Side.CLIENT)/*from   w w  w. j  a  va  2  s .  c om*/
public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution,
        float partialTicks, boolean hasScreen, int mouseX, int mouseY) {
    final ResourceLocation coraliumBlur = new ResourceLocation("abyssalcraft:textures/misc/coraliumblur.png");

    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && stack != null
            && stack.getItem() == AbyssalCraft.Depthshelmet) {
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

        Tessellator t = Tessellator.instance;

        ScaledResolution scale = new ScaledResolution(Minecraft.getMinecraft(),
                Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
        int width = scale.getScaledWidth();
        int height = scale.getScaledHeight();

        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);
        Minecraft.getMinecraft().renderEngine.bindTexture(coraliumBlur);

        t.startDrawingQuads();
        t.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D);
        t.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D);
        t.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D);
        t.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D);
        t.draw();

        GL11.glPopAttrib();
    }
}

From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java

License:Mozilla Public License

public InspectorCanvas(Composite parent, int style, GLData data) {
    super(parent, style, data);
    setCurrent();/*from  w  ww  . ja  va2s . com*/

    // Clear the canvas.
    GL11.glClearColor(CLEAR_COLOR[0], CLEAR_COLOR[1], CLEAR_COLOR[2], CLEAR_COLOR[3]);
    GL11.glClearDepth(1.0f);
    GL11.glLineWidth(1.0f);
    GL11.glPointSize(1.0f);

    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    GL11.glDisable(GL11.GL_LIGHTING);

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

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);

    GL11.glEnable(GL11.GL_STENCIL_TEST);
    GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf);
    GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    reset();

    mTransform = new Matrix4f();
    mTransform.setIdentity();

    addListener(SWT.Resize, this);
    addListener(SWT.Paint, this);
    addMouseListener(this);
    addMouseWheelListener(this);
}

From source file:com.xrbpowered.gl.examples.GLGlass.java

License:Open Source License

@Override
protected void drawObjects(RenderTarget target) {
    for (int i = 0; i < NUM_PLANES; i++)
        planeActors1[i].calcDepth();/*from  w  ww . j av  a  2s.co m*/
    Arrays.sort(planeActors1, depthSorter);

    Texture.unbind(3);
    Texture.unbind(5);
    for (int i = 0; i < NUM_OBJECTS; i++)
        objectActors[i].draw();
    blurMask.bind(4);
    glassShader.useBuffer(false);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(false);
    for (int i = 0; i < NUM_PLANES; i++)
        planeActors1[i].draw();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

    OffscreenBuffers.blit(target, interBuffers, false);

    blurBuffers.use();
    postProc.draw(interBuffers);

    target.use();
    glassShader.useBuffer(true);
    interBuffers.bindColorBuffer(3);
    blurBuffers.bindColorBuffer(5);
    for (int i = 0; i < NUM_PLANES; i++) {
        planeActors2[i].draw();
    }
}

From source file:com.xrbpowered.gl.res.shaders.PostProcessShader.java

License:Open Source License

public void draw(OffscreenBuffers src) {
    GL11.glDisable(GL11.GL_DEPTH_TEST);/*from  w w w.  j ava 2 s.co m*/
    GL11.glDepthMask(false);
    createQuad();

    use();
    if (src != null)
        src.bindColorBuffer(0);
    quad.draw();
    Texture.unbind(0);
    unuse();

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

From source file:com.xrbpowered.gl.res.SkyBox.java

License:Open Source License

public SkyBox(final Scene scene, String texturePathFormat) {
    texture = new CubeTexture(texturePathFormat);

    VertexInfo info = new VertexInfo().addAttrib("in_Position", 3);

    shader = new Shader(info, "sky_v.glsl", "sky_f.glsl") {
        private int projectionMatrixLocation;
        private int viewMatrixLocation;

        @Override//from www  .j av  a2s . c  o  m
        protected void storeUniformLocations() {
            projectionMatrixLocation = GL20.glGetUniformLocation(pId, "projectionMatrix");
            viewMatrixLocation = GL20.glGetUniformLocation(pId, "viewMatrix");
            GL11.glDepthMask(false);
        }

        @Override
        public void updateUniforms() {
            uniform(projectionMatrixLocation, scene.activeCamera.getProjection());
            uniform(viewMatrixLocation, scene.activeCamera.getFollowView());
            GL11.glDepthMask(true);
        }
    };

    cube = new StaticMesh(info,
            new float[] { -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f,
                    1.0f, -1.0f, -1.0f, 1.0f, -1.0f,

                    -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f,
                    1.0f, 1.0f, -1.0f, -1.0f, 1.0f,

                    1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
                    -1.0f, 1.0f, -1.0f, -1.0f,

                    -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f,
                    1.0f, -1.0f, -1.0f, 1.0f,

                    -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f,
                    1.0f, -1.0f, 1.0f, -1.0f,

                    -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f,
                    -1.0f, 1.0f, 1.0f, -1.0f, 1.0f },
            null);
}

From source file:com.xrbpowered.gl.ui.UIShader.java

License:Open Source License

@Override
public void use() {
    GL11.glDisable(GL11.GL_DEPTH_TEST);//from www  . j a  v a  2s .co m
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    super.use();
}

From source file:com.xrbpowered.gl.ui.UIShader.java

License:Open Source License

@Override
public void unuse() {
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    super.unuse();
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

@Override
public void clearBuffers(Color color, boolean clearColor, boolean clearDepth, boolean ignoreScissor) {

    clearBuffersState.backup();/*w  ww .ja  va 2s . c o m*/

    if (ignoreScissor) {
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
    }

    int clearFlags = 0;

    if (clearColor) {
        clearFlags |= GL11.GL_COLOR_BUFFER_BIT;
        GL11.glClearColor(color.getRedPremult(), color.getGreenPremult(), color.getBluePremult(),
                color.getAlpha());
    }

    if (clearDepth) {
        clearFlags |= GL11.GL_DEPTH_BUFFER_BIT;

        GL11.glDepthMask(true);
        GL11.glClear(clearFlags);

    } else {
        GL11.glClear(clearFlags);
    }

    clearBuffersState.restore();
}