本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.SpriteBatch.setBlendFunction方法的典型用法代码示例。如果您正苦于以下问题:Java SpriteBatch.setBlendFunction方法的具体用法?Java SpriteBatch.setBlendFunction怎么用?Java SpriteBatch.setBlendFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.SpriteBatch
的用法示例。
在下文中一共展示了SpriteBatch.setBlendFunction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderGL1
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
@Override
public void renderGL1(GL10 gl,float gameTime)
{
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
SpriteBatch batch = getSpriteBatch();
viewMatrix.setToOrtho2D(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch.setProjectionMatrix(viewMatrix);
batch.begin();
batch.disableBlending();
//begin render background
renderBackground(gameTime);
batch.end();
gl.glDisable(GL10.GL_DITHER);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glEnable(GL10.GL_CULL_FACE);
camera.update();
camera.apply(gl);
setLighting(gl);
for(IDrawable3D obj : collection)
if(obj.isVisible())
{
obj.renderGL1(gl, gameTime);
}
gl.glDisable(GL10.GL_CULL_FACE);
gl.glDisable(GL10.GL_DEPTH_TEST);
batch.setProjectionMatrix(viewMatrix);
//batch.setTransformMatrix(transformMatrix);
batch.begin();
batch.enableBlending();
//begin render foreground
renderForeground(gameTime);
batch.enableBlending();
batch.setBlendFunction(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
batch.end();
}
示例2: resetBlendFunction
import com.badlogic.gdx.graphics.g2d.SpriteBatch; //导入方法依赖的package包/类
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);
}