Example usage for com.badlogic.gdx Gdx gl20

List of usage examples for com.badlogic.gdx Gdx gl20

Introduction

In this page you can find the example usage for com.badlogic.gdx Gdx gl20.

Prototype

GL20 gl20

To view the source code for com.badlogic.gdx Gdx gl20.

Click Source Link

Usage

From source file:at.therefactory.jewelthief.ui.Particles.java

License:Open Source License

/**
 * if particle effect includes additive or pre-multiplied particle emitters
 * you can turn off blend function clean-up to save a lot of draw calls
 * but remember to switch the Batch back to GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
 * before drawing "regular" sprites or your Stage.
 *
 * @param batch/*from w  ww . j  a  v  a  2  s.co  m*/
 */
private void resetBlendFunction(SpriteBatch batch) {
    batch.setBlendFunction(-1, -1);
    Gdx.gl20.glBlendFuncSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_ONE,
            GL20.GL_DST_ALPHA);
}

From source file:com.andgate.ikou.view.FloorSelectScreen.java

License:Open Source License

@Override
public void render(float delta) {
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.draw();//from   w  ww .  j  a va2s.  co m

    if (Gdx.input.isKeyPressed(Input.Keys.BACK)) {
        gotoLevelSelect();
    }

    stage.act();
}

From source file:com.andgate.ikou.view.LevelBuilderScreen.java

License:Open Source License

@Override
public void render(float delta) {
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.draw();//from  w  w  w  .  j a v a 2s.co  m

    if (Gdx.input.isKeyPressed(Input.Keys.BACK)) {
        gotoMainMenu();
    }

    stage.act();
}

From source file:com.andgate.ikou.view.MainMenuScreen.java

License:Open Source License

@Override
public void render(float delta) {
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    //batch.begin();
    stage.draw();//from  w w w .j a v  a2s .  c o m
    //batch.end();

    if (Gdx.input.isKeyJustPressed(Input.Keys.BACK)) {
        Gdx.app.exit();
    }

    stage.act();
}

From source file:com.andgate.pokeadot.GameScreen.java

License:Open Source License

private void renderSetup() {
    Gdx.gl20.glClearColor(Constants.BG_COLOR.r, Constants.BG_COLOR.g, Constants.BG_COLOR.b, 1);
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // tell the camera to update its matrices.
    //camera.update();
    // tell the SpriteBatch to render in the
    // coordinate system specified by the camera.
    //game.batch.setProjectionMatrix(camera.combined);

    //game.batch.enableBlending();
    //game.batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:com.andgate.pokeadot.MainMenuScreen.java

License:Open Source License

@Override
public void render(float delta) {
    Gdx.gl20.glClearColor(Constants.BG_COLOR.r, Constants.BG_COLOR.g, Constants.BG_COLOR.b, 1);
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);

    game.batch.begin();//w  w  w .j  a  v  a 2  s .c  o m
    stage.draw();
    game.batch.end();
}

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

License:Apache License

/** Prepares the OpenGL state for SpriteCache rendering. */
public void begin() {
    if (drawing)/*from   w ww  .  ja  v a  2 s .c  o  m*/
        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 ww. j  a v  a 2 s .  co  m*/

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

From source file:com.badlogic.gdx.backends.android.CardBoardGraphics.java

License:Apache License

/** This instantiates the GL10, GL11 and GL20 instances. Includes the check for certain devices that pretend to support GL11 but
 * fuck up vertex buffer objects. This includes the pixelflinger which segfaults when buffers are deleted as well as the
 * Motorola CLIQ and the Samsung Behold II.
 *
 * @param gl *//* w ww. j  a va  2  s  .  c  o  m*/
private void setupGL() {
    if (gl20 != null)
        return;

    gl20 = new AndroidGL20();

    Gdx.gl = gl20;
    Gdx.gl20 = gl20;

    Gdx.app.log(LOG_TAG, "OGL renderer: " + gl20.glGetString(GL10.GL_RENDERER));
    Gdx.app.log(LOG_TAG, "OGL vendor: " + gl20.glGetString(GL10.GL_VENDOR));
    Gdx.app.log(LOG_TAG, "OGL version: " + gl20.glGetString(GL10.GL_VERSION));
    Gdx.app.log(LOG_TAG, "OGL extensions: " + gl20.glGetString(GL10.GL_EXTENSIONS));
}

From source file:com.badlogic.gdx.tests.dragome.examples.HelloTriangle.java

License:Apache License

@Override
public void render() {
    Gdx.gl20.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
    Gdx.gl.glClearColor(0, 0, 0, 1);//from   w  ww .j ava 2s  .  c om
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
    shader.begin();
    mesh.render(shader, GL20.GL_TRIANGLES);
    shader.end();
}