Java Code Examples for com.badlogic.gdx.graphics.GL20#GL_ONE_MINUS_SRC_ALPHA

The following examples show how to use com.badlogic.gdx.graphics.GL20#GL_ONE_MINUS_SRC_ALPHA . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CCParticleActor.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
public void initWithTotalParticles(int numberOfParticles, Texture texture) {
    _totalParticles = numberOfParticles;
    m_pParticles = new Particle[_totalParticles];
    vertices = new float[_totalParticles][20];
    m_uAllocatedParticles = numberOfParticles;
    _isActive = true;
    // default blend function
    blendSrc = GL20.GL_ONE;
    blendDst = GL20.GL_ONE_MINUS_SRC_ALPHA;
    _positionType = PositionTypeFree;
    _emitterMode = ParticleModeGravity;
    //
    _isAutoRemoveOnFinish = false;
    if (texture != null) {
        ownesTexture = false;
        setTexture(m_pTexture);
    } else {
        ownesTexture = true;
    }


}
 
Example 2
Source File: CCParticleActor.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
public void setBlendAdditive(boolean additive) {
    if (additive) {
        blendSrc = GL20.GL_SRC_ALPHA;
        blendDst = GL20.GL_ONE;
    } else {
        if (!preMultipliedAlpha) {
            blendSrc = GL20.GL_SRC_ALPHA;
            blendDst = GL20.GL_ONE_MINUS_SRC_ALPHA;
        } else {
            blendSrc = GL20.GL_ONE;
            blendDst = GL20.GL_ONE_MINUS_SRC_ALPHA;
        }
    }
}
 
Example 3
Source File: CCParticleActor.java    From cocos-ui-libgdx with Apache License 2.0 5 votes vote down vote up
protected void updateBlendFunc() {
    m_bOpacityModifyRGB = false;
    if (blendSrc == GL20.GL_ONE && blendDst == GL20.GL_ONE_MINUS_SRC_ALPHA) {
        if (preMultipliedAlpha) {
            m_bOpacityModifyRGB = true;
        } else {
            blendSrc = GL20.GL_SRC_ALPHA;
            blendDst = GL20.GL_ONE_MINUS_SRC_ALPHA;
        }
    }
}
 
Example 4
Source File: LibgdxGraphics.java    From mini2Dx with Apache License 2.0 5 votes vote down vote up
private int convertBlendFunction(Mini2DxBlendFunction func) {
	switch(func) {
		default:
		case ZERO:
			return GL20.GL_ZERO;
		case ONE:
			return GL20.GL_ONE;
		case SRC_COLOR:
			return GL20.GL_SRC_COLOR;
		case ONE_MINUS_SRC_COLOR:
			return GL20.GL_ONE_MINUS_SRC_COLOR;
		case DST_COLOR:
			return GL20.GL_DST_COLOR;
		case ONE_MINUS_DST_COLOR:
			return GL20.GL_ONE_MINUS_DST_COLOR;
		case SRC_ALPHA:
			return GL20.GL_SRC_ALPHA;
		case ONE_MINUS_SRC_ALPHA:
			return GL20.GL_ONE_MINUS_SRC_ALPHA;
		case DST_ALPHA:
			return GL20.GL_DST_ALPHA;
		case ONE_MINUS_DST_ALPHA:
			return GL20.GL_ONE_MINUS_DST_ALPHA;
		case SRC_ALPHA_SATURATE:
			return GL20.GL_SRC_ALPHA_SATURATE;
	}
}
 
Example 5
Source File: BlendingAttribute.java    From uracer-kotd with Apache License 2.0 4 votes vote down vote up
/** Utility constuctor for basic transparency blendSrcFunc = GL10.GL_SRC_ALPHA blendDstFunc = GL10.GL_ONE_MINUS_SRC_ALPHA
 * @param name */
public BlendingAttribute (String name) {
	this(name, GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}