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:info.plugmania.novacraft.event.gui.Render3DUnderlayEvent.java

License:GNU General Public License

public void enable() {
    GL11.glPushMatrix();//from ww w .  j ava 2  s .c  o m
    GL11.glDepthMask(true);
    //GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    Minecraft.getMinecraft().entityRenderer.disableLightmap(1.0D);
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glDepthMask(boolean flag) {
    GL11.glDepthMask(flag);
}

From source file:itdelatrisu.opsu.render.CurveRenderState.java

License:Open Source License

/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve./*  www.  j a va 2s. c  o m*/
 */
private RenderState startRender() {
    RenderState state = new RenderState();
    state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
    state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
    state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
    state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
    state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
    state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
    state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
    state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
    GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL14.glBlendEquation(GL14.GL_FUNC_ADD);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_TEXTURE_1D);
    GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

    GL20.glUseProgram(0);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    return state;
}

From source file:itdelatrisu.opsu.render.CurveRenderState.java

License:Open Source License

/**
 * Restore the old OpenGL state that's backed up in {@code state}.
 * @param state the old state to restore
 */// w ww  .  j a va  2s.  c  o m
private void endRender(RenderState state) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL20.glUseProgram(state.oldProgram);
    GL13.glActiveTexture(state.texUnit);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, state.oldArrayBuffer);
    if (!state.depthWriteEnabled)
        GL11.glDepthMask(false);
    if (!state.depthEnabled)
        GL11.glDisable(GL11.GL_DEPTH_TEST);
    if (state.texEnabled)
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    if (state.smoothedPoly)
        GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    if (!state.blendEnabled)
        GL11.glDisable(GL11.GL_BLEND);
}

From source file:ivorius.ivtoolkit.raytracing.IvRaytracer.java

License:Apache License

public static void drawStandardOutlines(List<IvRaytraceableObject> objects) {
    GL11.glEnable(GL11.GL_BLEND);//from  w  ww  .ja  v  a 2s  .co  m
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);
    //      GL11.glColor4f(0, 0, 0, 0.4f);

    Random r = new Random(0);
    for (IvRaytraceableObject object : objects) {
        int color = r.nextInt();
        GL11.glColor4f(((color >> 16) & 255) / 255.0f, ((color >> 8) & 255) / 255.0f,
                ((color >> 0) & 255) / 255.0f, 0.8F);
        object.drawOutlines();
    }

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

From source file:ivorius.ivtoolkit.rendering.IvRenderHelper.java

License:Apache License

public static void renderLights(float ticks, int color, float alpha, int number) {
    float width = 2.5f;

    Tessellator tessellator = Tessellator.instance;

    float usedTicks = ticks / 200.0F;

    Random random = new Random(432L);
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from  www.  j  a v a  2s  . c o  m
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    for (int var7 = 0; (float) var7 < number; ++var7) {
        float xLogFunc = (((float) var7 / number * 28493.0f + ticks) / 10.0f) % 20.0f;
        if (xLogFunc > 10.0f) {
            xLogFunc = 20.0f - xLogFunc;
        }

        float yLogFunc = 1.0f / (1.0f + (float) Math.pow(2.71828f, -0.8f * xLogFunc) * ((1.0f / 0.01f) - 1.0f));

        float lightAlpha = yLogFunc;

        if (lightAlpha > 0.01f) {
            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 + usedTicks * 90.0F, 0.0F, 0.0F, 1.0F);
            tessellator.startDrawing(6);
            float var8 = random.nextFloat() * 20.0F + 5.0F;
            float var9 = random.nextFloat() * 2.0F + 1.0F;
            tessellator.setColorRGBA_I(color, (int) (255.0F * alpha * lightAlpha));
            tessellator.addVertex(0.0D, 0.0D, 0.0D);
            tessellator.setColorRGBA_I(color, 0);
            tessellator.addVertex(-width * (double) var9, var8, (-0.5F * var9));
            tessellator.addVertex(width * (double) var9, var8, (-0.5F * var9));
            tessellator.addVertex(0.0D, var8, (1.0F * var9));
            tessellator.addVertex(-width * (double) var9, var8, (-0.5F * var9));
            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);
}

From source file:jake2.desktop.LWJGLAdapter.java

License:Open Source License

@Override
public void glDepthMask(boolean b) {
    GL11.glDepthMask(b);
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public void setDepthMask(boolean depthWriteEnabled) {
    GL11.glDepthMask(depthWriteEnabled);
}

From source file:kuake2.render.lwjgl.Light.java

License:Open Source License

/**
 * R_RenderDlights/*from   ww w  . j  a v  a  2  s.  c o  m*/
 */
void R_RenderDlights() {
    if (gl_flashblend.value == 0)
        return;

    r_dlightframecount = r_framecount + 1; // because the count hasn't
    //  advanced yet for this frame
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

    for (int i = 0; i < r_newrefdef.num_dlights; i++) {
        R_RenderDlight(r_newrefdef.dlights[i]);
    }

    GL11.glColor3f(1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(true);
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_DrawEntitiesOnList/*w  ww  .  java 2 s .c o  m*/
 */
void R_DrawEntitiesOnList() {
    if (r_drawentities.value == 0.0f)
        return;

    // draw non-transparent first
    int i;
    for (i = 0; i < r_newrefdef.num_entities; i++) {
        currententity = r_newrefdef.entities[i];
        if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0)
            continue; // solid

        if ((currententity.flags & Defines.RF_BEAM) != 0) {
            R_DrawBeam(currententity);
        } else {
            currentmodel = currententity.model;
            if (currentmodel == null) {
                R_DrawNullModel();
                continue;
            }
            switch (currentmodel.type) {
            case mod_alias:
                R_DrawAliasModel(currententity);
                break;
            case mod_brush:
                R_DrawBrushModel(currententity);
                break;
            case mod_sprite:
                R_DrawSpriteModel(currententity);
                break;
            default:
                Com.Error(Defines.ERR_DROP, "Bad modeltype");
                break;
            }
        }
    }
    // draw transparent entities
    // we could sort these if it ever becomes a problem...
    GL11.glDepthMask(false); // no z writes
    for (i = 0; i < r_newrefdef.num_entities; i++) {
        currententity = r_newrefdef.entities[i];
        if ((currententity.flags & Defines.RF_TRANSLUCENT) == 0)
            continue; // solid

        if ((currententity.flags & Defines.RF_BEAM) != 0) {
            R_DrawBeam(currententity);
        } else {
            currentmodel = currententity.model;

            if (currentmodel == null) {
                R_DrawNullModel();
                continue;
            }
            switch (currentmodel.type) {
            case mod_alias:
                R_DrawAliasModel(currententity);
                break;
            case mod_brush:
                R_DrawBrushModel(currententity);
                break;
            case mod_sprite:
                R_DrawSpriteModel(currententity);
                break;
            default:
                Com.Error(Defines.ERR_DROP, "Bad modeltype");
                break;
            }
        }
    }
    GL11.glDepthMask(true); // back to writing
}