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

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

Introduction

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

Prototype

int GL_FUNC_SUBTRACT

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

Click Source Link

Usage

From source file:es.eucm.ead.editor.components.EditorImageActor.java

License:Open Source License

protected void drawCollider(Batch batch) {
    if (getCollider() != null) {
        batch.end();//  ww  w. ja v  a2  s.co m
        Gdx.gl.glEnable(GL20.GL_BLEND);
        Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_DST_COLOR);
        Gdx.gl.glBlendEquation(GL20.GL_FUNC_SUBTRACT);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.setTransformMatrix(batch.getTransformMatrix());
        shapeRenderer.begin(ShapeType.Line);
        shapeRenderer.setColor(Color.WHITE);
        for (Polygon polygon : getCollider()) {
            float[] vertices = polygon.getVertices();
            shapeRenderer.polygon(vertices);
        }
        shapeRenderer.end();
        Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD);
        Gdx.gl.glDisable(GL20.GL_BLEND);
        batch.begin();
    }
}

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

License:Open Source License

@Override
protected void drawChildren(Batch batch, float parentAlpha) {
    batch.end();//ww w.  j a va2s.  com
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_DST_COLOR);
    Gdx.gl.glBlendEquation(GL20.GL_FUNC_SUBTRACT);
    shapeRenderer.setColor(Color.WHITE);
    shapeRenderer.begin(ShapeType.Line);
    super.drawChildren(batch, parentAlpha);
    shapeRenderer.end();
    Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD);
    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
}

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

License:Open Source License

@Override
protected void drawChildren(Batch batch, float parentAlpha) {
    batch.end();//from  w w w .  j a  v  a 2 s  . c om
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_DST_COLOR);
    Gdx.gl.glBlendEquation(GL20.GL_FUNC_SUBTRACT);
    shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
    shapeRenderer.setTransformMatrix(batch.getTransformMatrix());
    shapeRenderer.begin(ShapeType.Line);
    shapeRenderer.setColor(Color.WHITE);
    shapeRenderer.line(handles[0].getX(), handles[0].getY(), handles[2].getX(), handles[2].getY());
    shapeRenderer.line(handles[0].getX(), handles[0].getY(), handles[6].getX(), handles[6].getY());
    shapeRenderer.line(handles[2].getX(), handles[2].getY(), handles[8].getX(), handles[8].getY());
    shapeRenderer.line(handles[8].getX(), handles[8].getY(), handles[6].getX(), handles[6].getY());
    shapeRenderer.end();
    super.drawChildren(batch, parentAlpha);
    Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD);
    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
}