List of usage examples for com.badlogic.gdx.graphics GL20 GL_SRC_ALPHA
int GL_SRC_ALPHA
To view the source code for com.badlogic.gdx.graphics GL20 GL_SRC_ALPHA.
Click Source Link
From source file:com.shatteredpixel.shatteredpixeldungeon.ui.Archs.java
License:Open Source License
@Override protected void createChildren() { arcsBg = new SkinnedBlock(1, 1, Assets.ARCS_BG) { @Override/*from w w w . jav a2s . c o m*/ protected NoosaScript script() { return NoosaScriptNoLighting.get(); } @Override public void draw() { //arch bg has no alpha component, this improves performance Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ZERO); super.draw(); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); } }; arcsBg.autoAdjust = true; arcsBg.offsetTo(0, offsB); add(arcsBg); arcsFg = new SkinnedBlock(1, 1, Assets.ARCS_FG) { @Override protected NoosaScript script() { return NoosaScriptNoLighting.get(); } }; arcsFg.autoAdjust = true; arcsFg.offsetTo(0, offsF); add(arcsFg); }
From source file:com.strategames.ui.helpers.FilledRectangleImage.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { batch.end();/*w w w . j a va2s .co m*/ Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); this.shapeRendererColor.a = this.color.a; this.shapeRendererColor.r = this.color.r; this.shapeRendererColor.g = this.color.g; this.shapeRendererColor.b = this.color.b; this.shapeRenderer.begin(ShapeType.Filled); this.shapeRenderer.rect(getX(), getY(), getWidth(), getHeight()); this.shapeRenderer.end(); Gdx.gl.glDisable(GL20.GL_BLEND); batch.begin(); }
From source file:com.thetruthbeyond.gui.utility.gl.GlUtils.java
License:Open Source License
public static void setDefaultBlendMode(SmartSpriteBatch batch) { batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); }
From source file:com.tnf.ptm.common.CommonDrawer.java
License:Apache License
public void setAdditive(boolean additive) { int dstFunc = additive ? GL20.GL_ONE : GL20.GL_ONE_MINUS_SRC_ALPHA; mySpriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, dstFunc); }
From source file:com.torrosoft.sopistan.SopistanMain.java
License:Open Source License
@Override public void render() { if (istate == 5) return;//ww w.j a va 2 s. c o m batch.begin(); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); cam.update(); batch.setProjectionMatrix(cam.combined); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); tex.bind(); // the end cap scale tris.setEndCap(5F); // the thickness of the line tris.setThickness(30F); // generate the triangle strip from our path tris.update(swipe.getPath()); // the vertex color for tinting, i.e. for opacity tris.setColor(Color.RED); // render the triangles to the screen tris.draw(cam); int idx = 0; for (int y = 0; y < Position.MAX_Y; y++) { for (int x = 0; x < Position.MAX_X; x++) { ((Sprite) group_sprites.get(idx)).draw(batch); idx++; } } // uncomment to see debug lines //drawDebug(); batch.end(); istate = 1; }
From source file:com.uwsoft.editor.gdx.ui.components.ItemPhysicsEditor.java
License:Apache License
@Override public void draw(Batch batch, float parentAlpha) { //super.draw(batch, parentAlpha); if (isTransform()) applyTransform(batch, computeTransform()); Rectangle calculatedScissorBounds = Pools.obtain(Rectangle.class); getStage().calculateScissors(new Rectangle(0, 0, getWidth(), getHeight()), calculatedScissorBounds); // Enable scissors. if (ScissorStack.pushScissors(calculatedScissorBounds)) { drawChildren(batch, parentAlpha); ScissorStack.popScissors();/*from w ww. j a va 2 s . c o m*/ if (isTransform()) resetTransform(batch); } batch.end(); Gdx.gl.glLineWidth(2); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); // shapeRenderer.setProjectionMatrix(stage.getCamera().combined); Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST); Gdx.gl.glScissor((int) calculatedScissorBounds.x, (int) calculatedScissorBounds.y, (int) getWidth(), (int) getHeight()); Pools.free(calculatedScissorBounds); if (currentMode == EditMode.Create) { drawOutlines(); drawPoints(); drawNextLine(); } if (currentMode == EditMode.Edit) { drawPolygon(); drawOutlines(); drawPoints(); } Gdx.gl.glDisable(GL20.GL_SCISSOR_TEST); Gdx.gl.glDisable(GL20.GL_BLEND); if (currentMode == EditMode.Test) { box2dRenderer.render(physicsEditorWorld, stage.getCamera().combined.scl(1 / PhysicsBodyLoader.SCALE)); } batch.begin(); }
From source file:com.vlaaad.dice.ui.components.Rain.java
License:Open Source License
@Override public void draw(Batch batch, float parentAlpha) { validate();/* w w w . j a v a2 s . co m*/ batch.end(); Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); ShapeRenderer renderer = Config.shapeRenderer; renderer.setProjectionMatrix(batch.getProjectionMatrix()); renderer.setTransformMatrix(batch.getTransformMatrix()); renderer.begin(ShapeRenderer.ShapeType.Filled); renderer.setColor(style.color.r, style.color.g, style.color.b, style.color.a * parentAlpha); float usedWidth = getWidth() - style.pad; int count = (int) (usedWidth / (style.dropWidth + style.pad)); if (count == 0) return; float step = usedWidth / ((float) count); float x = style.pad; for (int i = 0, n = rows.size; i < n; i++) { Row row = rows.get(i); drawRow(x, row); x += step; } renderer.end(); Gdx.gl.glDisable(GL20.GL_BLEND); batch.begin(); }
From source file:com.watabou.noosa.Game.java
License:Open Source License
public void onSurfaceCreated() { Gdx.gl.glEnable(GL20.GL_BLEND);//from www. j a v a 2s. c om // For premultiplied alpha: // Gdx.gl.glBlendFunc( GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA ); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST); TextureCache.reload(); }
From source file:com.watabou.noosa.particles.Emitter.java
License:Open Source License
@Override public void draw() { if (lightMode) { Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE); super.draw(); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); } else {//from w w w.ja v a 2 s. c o m super.draw(); } }
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 ww. j av a 2s .co 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); } }