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

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

Introduction

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

Prototype

int GL_ONE_MINUS_SRC_ALPHA

To view the source code for com.badlogic.gdx.graphics GL20 GL_ONE_MINUS_SRC_ALPHA.

Click Source Link

Usage

From source file:com.zombie.game.actors.SteeringActor.java

License:Apache License

public void setModelInstance(ModelInstance modelInstance) {
    this.modelInstance = modelInstance;
    this.transform = modelInstance.transform.val;
    for (Material m : modelInstance.materials) {
        m.set(new IntAttribute(IntAttribute.CullFace, GL20.GL_NONE));
        m.set(new FloatAttribute(FloatAttribute.AlphaTest, 0.5f));
        m.set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
    }//from w  w  w . java2 s .c  o  m
    //Get animations if any
    if (modelInstance.animations.size > 0) {
        animationController = new AnimationController(modelInstance);
        animationController.allowSameAnimation = true;
        animationController.animate(modelInstance.animations.get(0).id, -1, 1f, this, 1f);
    }
}

From source file:de.brainstormsoftworks.taloonerrl.render.Renderer.java

License:Open Source License

/**
 * sets the blending for the screen sprite batch to the normal behavior
 */// w  w w  .j a  v a2 s  .  c o m
public void setScreenBlendingNormal() {
    spriteBatchScreen.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:de.caffeineaddicted.sgl.ui.screens.SGLStagedScreen.java

License:BEER-WARE LICENSE

@Override
protected final void draw() {
    onBeforeDraw();//from   w  w w  .  j a  va 2  s  .  co  m
    if (dimBackground) {
        Gdx.gl.glEnable(GL20.GL_BLEND);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        SGL.provide(ShapeRenderer.class).begin(ShapeRenderer.ShapeType.Filled);
        SGL.provide(ShapeRenderer.class).setColor(0f, 0f, 0f, Math.min(1f, Math.max(0f, dimFactor)));
        SGL.provide(ShapeRenderer.class).rect(stage.getViewOrigX(), stage.getViewOrigY(), stage.getWidth(),
                stage.getHeight());
        SGL.provide(ShapeRenderer.class).end();
        Gdx.gl.glDisable(GL20.GL_BLEND);
    }
    stage.draw();
    onAfterDraw();
}

From source file:de.gebatzens.meteva.GScout.java

License:Open Source License

@Override
public void render() {
    if (trace)//from   w  w w  .  j  a  v  a 2  s.  c  om
        tracei.beginTrace("rendertrace");
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    //batch.setProjectionMatrix(camera.combined);
    batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    batch.enableBlending();
    batch.begin();
    state.render();
    state.update(Gdx.graphics.getDeltaTime());

    batch.end();
    if (trace) {
        tracei.endTrace();
        trace = false;
    }
}

From source file:de.longri.cachebox3.gui.stages.Splash.java

License:Open Source License

private void doneLoading() {

    log.info("Add 3DModels");

    Model myLocationModel = assets.get("skins/day/3d_model/Pfeil.g3db", Model.class);
    myLocationModel.materials.get(0).set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
    myLocationModel.nodes.get(0).parts.get(0).material.set(FloatAttribute.createAlphaTest(0.1f));
    SkinLoaderTask.myLocationModel = myLocationModel;

    Model compassModel = assets.get("skins/day/3d_model/compass.g3db", Model.class);
    //        compassModel.materials.get(0).set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
    //        compassModel.nodes.get(0).parts.get(0).material.set(FloatAttribute.createAlphaTest(0.1f));
    SkinLoaderTask.compassModel = compassModel;

    Model compassGrayModel = assets.get("skins/day/3d_model/compass_gray.g3db", Model.class);
    //        compassGrayModel.materials.get(0).set(new BlendingAttribute(GL20.GL_SRC_COLOR, GL20.GL_ONE_MINUS_SRC_COLOR));
    //        compassGrayModel.nodes.get(0).parts.get(0).material.set(FloatAttribute.createAlphaTest(0.1f));
    SkinLoaderTask.compassGrayModel = compassGrayModel;

    Model compassYellowModel = assets.get("skins/day/3d_model/compass_yellow.g3db", Model.class);
    //        compassYellowModel.materials.get(0).set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));
    //        compassYellowModel.nodes.get(0).parts.get(0).material.set(FloatAttribute.createAlphaTest(0.1f));
    SkinLoaderTask.compassYellowModel = compassYellowModel;

    loading = false;/*from  w  w w  .ja  v  a2  s  . c om*/
}

From source file:dorkbox.tweenengine.demo.Launcher.java

License:Apache License

public void render() {
    tweenManager.update(Gdx.graphics.getDeltaTime());

    GL20 gl = Gdx.gl20;/* ww w.  j a v  a  2s .  c om*/
    gl.glClearColor(1, 1, 1, 1);
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    gl.glEnable(GL20.GL_BLEND);
    gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    int w = Gdx.graphics.getWidth();
    int h = Gdx.graphics.getHeight();

    if (selectedTile == null) {
        batch.getProjectionMatrix().setToOrtho2D(0, 0, w, h);
        batch.begin();
        batch.disableBlending();
        background.draw(batch);
        batch.end();

        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        batch.enableBlending();
        for (int i = 0; i < tiles.size(); i++) {
            tiles.get(i).draw(batch);
        }
        batch.end();

        batch.getProjectionMatrix().setToOrtho2D(0, 0, w, h);

        batch.begin();
        batch.disableBlending();
        title.draw(batch);
        titleLeft.draw(batch);
        titleRight.draw(batch);
        batch.enableBlending();

        if (veil.getColor().a > 0.1f) {
            veil.draw(batch);
        }
        batch.end();

    } else {
        selectedTile.getTest().render();
    }
}

From source file:dorkbox.tweenengine.demo.SplashScreen.java

License:Apache License

public void render() {
    tweenManager.update(Gdx.graphics.getDeltaTime());

    if (gdx.getRotation() > 360 * 15 - 20) {
        gdx.setRegion(gdxTex);/* w w w .  ja va  2s.c o  m*/
    }

    GL20 gl = Gdx.gl20;
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    gl.glEnable(GL20.GL_BLEND);
    gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    strip.draw(batch);
    universal.draw(batch);
    tween.draw(batch);
    engine.draw(batch);
    logo.draw(batch);
    powered.draw(batch);
    gdx.draw(batch);

    if (veil.getColor().a > 0.1f) {
        veil.draw(batch);
    }
    batch.end();

    if (finishedAnimation) {
        callback.onEvent(null);
    }
}

From source file:es.eucm.ead.editor.view.scene.SimpleSceneViewer.java

License:Open Source License

@Override
public void create() {
    batch = new SpriteBatch();
    batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    batch.enableBlending();/*  ww  w.j av a2s . co m*/
    camera = new InvOrtographicCamera();
    time = 0;
    lwjglCanvas.getInput().setInputProcessor(new SceneViewerInputProcessor(this, new LoggerSceneListener()));
    initTextures();
}

From source file:es.eucm.ead.editor.view.widgets.groupeditor.GroupEditor.java

License:Open Source License

@Override
protected void drawChildren(Batch batch, float parentAlpha) {
    if (background != null) {
        background.draw(batch, 0, 0, getWidth(), getHeight());
    }/*from w  w  w .  j  a  v a2  s .  com*/
    super.drawChildren(batch, parentAlpha);
    if (selection.getWidth() != 0 && selection.getHeight() != 0) {
        batch.end();
        Gdx.gl.glEnable(GL20.GL_BLEND);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.setTransformMatrix(batch.getTransformMatrix());
        drawSelectionRectangle();
        Gdx.gl.glDisable(GL20.GL_BLEND);
        batch.begin();
    }
}

From source file:es.eucm.ead.engine.utils.assetviewer.AssetApplicationListener.java

License:Open Source License

@Override
public void create() {
    spriteBatch = new GdxCanvas();
    spriteBatch.enableBlending();/*w w  w.  j a va  2 s . c o  m*/
    spriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    camera = new InvOrtographicCamera();
    // XXX canvas.setGraphicContext(spriteBatch);
    time = 0;
    createBackgroundPattern();
}