i have problem glreadpixels/screenutils.getframebufferpixmap() semi-transparent sprites drawn on top of opaque ones seem "overwrite" transparency, resulting in mess.
black sprites 10% transparency drawn on top of tiles shadows.
original (in-game) image:
image obtained glreadpixels in screenutils.getframebufferpixmap(...):
(the shadows white because they're transparent)
how make alpha blending work in getframebufferpixmap()?
you need use glblendfuncseparate
instead of glblendfunc
, spritebatch uses. spritebatch provides door (undocumented think reason) using glblendfuncseparate
. set it's blend function parameters -1, , can manually set own glblendfuncseparate
leaves alpha of frame buffer 1.0:
spritebatch.setblendfunction(-1, -1); gdx.gl.glblendfuncseparate( gl20.gl_src_alpha, gl20.gl_one_minus_src_alpha, gl20.gl_zero, gl20.gl_one); //... spritebatch.begin(); //... spritebatch.end();
also make sure alpha of glclearcolor
1.0f
.
Comments
Post a Comment