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

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

Introduction

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

Prototype

public void glDisable(int cap);

Source Link

Usage

From source file:com.badlogic.invaders.Renderer.java

License:Apache License

public void render(Simulation simulation, float delta) {
    // We explicitly require GL10, otherwise we could've used the GLCommon
    // interface via Gdx.gl
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
    renderBackground();/*from w  w w.  j  a  va  2  s.  c o m*/
    gl.glEnable(GL20.GL_DEPTH_TEST);
    gl.glEnable(GL20.GL_CULL_FACE);
    setProjectionAndCamera(simulation.ship);

    modelBatch.begin(camera);
    modelBatch.render(simulation.explosions);
    if (!simulation.ship.isExploding)
        modelBatch.render(simulation.ship, lights);
    modelBatch.render(simulation.invaders, lights);
    modelBatch.render(simulation.blocks);
    modelBatch.render(simulation.shots);
    modelBatch.end();

    gl.glDisable(GL20.GL_CULL_FACE);
    gl.glDisable(GL20.GL_DEPTH_TEST);

    spriteBatch.setProjectionMatrix(viewMatrix);
    spriteBatch.begin();
    if (simulation.ship.lives != lastLives || simulation.score != lastScore || simulation.wave != lastWave) {
        status = "lives: " + simulation.ship.lives + " wave: " + simulation.wave + " score: "
                + simulation.score;
        lastLives = simulation.ship.lives;
        lastScore = simulation.score;
        lastWave = simulation.wave;
    }
    spriteBatch.enableBlending();
    font.draw(spriteBatch, status, 0, 320);
    spriteBatch.end();

    invaderAngle += delta * 90;
    if (invaderAngle > 360)
        invaderAngle -= 360;
}

From source file:com.badlogicgames.superjumper.helpscreen.HelpScreen2.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();//from w  w  w  . ja v a2s.  c  o  m

    game.batch.setProjectionMatrix(guiCam.combined);
    game.batch.disableBlending();
    game.batch.begin();
    game.batch.draw(helpRegion, 0, 0, 320, 480);
    game.batch.end();

    game.batch.enableBlending();
    game.batch.begin();
    game.batch.draw(Assets.arrow, 320, 0, -64, 64);
    game.batch.end();

    gl.glDisable(GL20.GL_BLEND);
}

From source file:com.bss.game.HelpScreen5.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();/*  ww w.  j a v  a2 s .c  o  m*/

    game.batcher.setProjectionMatrix(guiCam.combined);
    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(helpRegion, 0, 0, 480, 800);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.arrow, 480, 100, -150, 100);
    game.batcher.end();

    gl.glDisable(GL20.GL_BLEND);
}

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();//  w w  w.  j a v a 2 s.  c  o  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:com.mygdx.game.superjumper.screen.HelpScreen2.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();//w w w  . j  a v  a 2s .c  o  m

    game.batcher.setProjectionMatrix(guiCam.combined);
    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(helpRegion, 0, 0, 320, 480);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.arrow, 320, 0, -64, 64);
    game.batcher.end();

    gl.glDisable(GL20.GL_BLEND);
}

From source file:com.wilson.game.Screen.HelpScreen2.java

License:Apache License

public void draw() {
    GL20 gl = Gdx.gl;
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    guiCam.update();//  w w w . j a  v a  2s .  co  m

    game.batcher.setProjectionMatrix(guiCam.combined);
    game.batcher.disableBlending();
    game.batcher.begin();
    game.batcher.draw(helpRegion, 0, 0, 320, 480);
    game.batcher.end();

    game.batcher.enableBlending();
    game.batcher.begin();
    game.batcher.draw(Assets.arrow, 320, 0, -30, 30);
    game.batcher.end();

    gl.glDisable(GL20.GL_BLEND);
}

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()}
 *//*from www .j a  va2s  .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();
    }
}