Example usage for com.badlogic.gdx.graphics GL20 glDepthMask

List of usage examples for com.badlogic.gdx.graphics GL20 glDepthMask

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 glDepthMask.

Prototype

public void glDepthMask(boolean flag);

Source Link

Usage

From source file:com.anythingmachine.gdxwrapper.SpriteCache.java

License:Apache License

/** Prepares the OpenGL state for SpriteCache rendering. */
public void begin() {
    if (drawing)// ww  w . j  a  va  2 s .  com
        throw new IllegalStateException("end must be called before begin.");

    combinedMatrix.set(projectionMatrix).mul(transformMatrix);

    GL20 gl = Gdx.gl20;
    gl.glDepthMask(false);

    if (customShader != null) {
        customShader.begin();
        customShader.setUniformMatrix("u_proj", projectionMatrix);
        customShader.setUniformMatrix("u_trans", transformMatrix);
        customShader.setUniformMatrix("u_projTrans", combinedMatrix);
        customShader.setUniformi("u_texture", 0);
    } else {
        shader.begin();
        shader.setUniformMatrix("u_projectionViewMatrix", combinedMatrix);
        shader.setUniformi("u_texture", 0);
    }

    mesh.bind(shader);
    drawing = true;
}

From source file:com.anythingmachine.gdxwrapper.SpriteCache.java

License:Apache License

/** Completes rendering for this SpriteCache.f */
public void end() {
    if (!drawing)
        throw new IllegalStateException("begin must be called before end.");
    drawing = false;/*  w  w  w . j av  a  2s . c o m*/

    shader.end();
    GL20 gl = Gdx.gl20;
    gl.glDepthMask(true);
    mesh.unbind(shader);
}

From source file:com.doom.render.QuadBatch.java

License:Apache License

@Override
public void end() {
    if (!drawing)
        throw new IllegalStateException("SpriteBatch.begin must be called before end.");
    if (idx > 0)
        flush();/*from w  w  w . j a  v  a 2 s  . co m*/
    lastTexture = null;
    drawing = false;

    GL20 gl = Gdx.gl20;
    gl.glDepthMask(true);
    if (isBlendingEnabled())
        gl.glDisable(GL20.GL_BLEND);

    if (customShader != null)
        customShader.end();
    else
        shader.end();
}

From source file:tools.SpriteBatch.java

License:Apache License

/**
 * Finishes off rendering. Enables depth writes, disables blending and
 * texturing. Must always be called after a call to {@link #begin()}
 *//* w w  w.ja va2  s .c o m*/
public void end() {
    if (!drawing) {
        throw new IllegalStateException("SpriteBatch.begin must be called before end.");
    }
    if (idx > 0) {
        renderMesh();
    }
    lastTexture = null;
    idx = 0;
    drawing = false;

    GL20 gl = Gdx.gl;
    gl.glDepthMask(true);
    if (isBlendingEnabled()) {
        gl.glDisable(GL20.GL_BLEND);
    }

    if (customShader != null) {
        customShader.end();
    } else {
        shader.end();
    }
}