- .
, . spritebatch . . , . . . - :
, -:
public void render(SpriteBatch batch, int renderLayer) {
if(renderLayer == Integer.parseInt(render_layer)){
batch.draw(item.region,
item.position.x,
item.position.y,
0,
0,
item.region.getRegionWidth() ,
item.region.getRegionHeight(),
item.t_scale,
item.t_scale,
item.manager.radiansToDegrees(item.rotation));
}
}
, , , , , .
, : https://gist.github.com/mattdesl/6076846 - , , , , :
public void render(SpriteBatch batch, int renderLayer) {
if(renderLayer == Integer.parseInt(render_layer)){
batch.enableBlending();
drawAlphaMask(batch, item.position.x, item.position.y, item.region.getRegionWidth(), item.region.getRegionHeight());
drawForeground(batch, item.position.x, item.position.y, item.region.getRegionWidth(), item.region.getRegionHeight());
batch.disableBlending();
}
}
TextureRegion alphaMask, .
, /:

, :
private void drawAlphaMask(SpriteBatch batch, float x, float y, float width, float height) {
Gdx.gl.glColorMask(false, false, false, true);
dst = batch.getBlendDstFunc();
src = batch.getBlendSrcFunc();
batch.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ZERO);
batch.draw(alphaRegion,
x,
y,
0,
0,
alphaRegion.getRegionWidth(),
alphaRegion.getRegionHeight(),
item.t_scale,
item.t_scale,
item.manager.radiansToDegrees(item.rotation));
batch.flush();
}
"" . spriteRegion. , :

, drawForeground, , :
private void drawForeground(SpriteBatch batch, float clipX, float clipY, float clipWidth, float clipHeight) {
Gdx.gl.glColorMask(true, true, true, true);
batch.setBlendFunction(GL10.GL_DST_ALPHA, GL10.GL_ONE_MINUS_DST_ALPHA);
batch.draw(spriteRegion,
clipX,
clipY,
0,
0,
spriteRegion.getRegionWidth() ,
spriteRegion.getRegionHeight(),
item.t_scale,
item.t_scale,
item.manager.radiansToDegrees(item.rotation));
batch.flush();
batch.setBlendFunction(src, dst);
}
"Brick Beams" ( - ) :

Android GWT ( libgdx) - .
: https://github.com/libgdx/libgdx/wiki/Integrating-libgdx-and-the-device-camera
Android, MainActivity.java onCreate :
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.useGL20 = false;
cfg.r = 8;
cfg.g = 8;
cfg.b = 8;
cfg.a = 8;
initialize(new SuperContraption("android"), cfg);
if (graphics.getView() instanceof SurfaceView) {
SurfaceView glView = (SurfaceView) graphics.getView();
glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
}
}
Android.
, gwt, , libgdx GWT, webGl, -. , - (, , ).
- , GWT, .
GWT, :
https://supercontraption.com/assets/play/index.html