UPDATE 1
As you can see LibGDX Texture drawn on FrameBuffer, then on SpriteBatcher is darker then original Texture in comparison with Texture drawn directly on SpriteBatcher.
Left part is original image, which is 50% smaller of phone 1080x1920 screen.
Middle part is drawn directly from TextureRegion on SpriteBatch, and is mirrored horizontally for better comparison with left and right images. It is little distorted, but I enabled Linear filtering as you can see in code:
texture = new Texture("texture.png");
texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
image = new TextureRegion(texture, 0, 0, 1024, 1024);
batcher.begin();
batcher.draw(image, 0, 0, screenWidth, screenHeight);
batcher.end();
Right part is TextureRegion drawn on FrameBuffer first, then drawn on SpriteBatch, like in following code:
texture = new Texture("texture.png");
texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
image = new TextureRegion(texture, 0, 0, 1024, 1024);
pixmap = new FrameBuffer(Pixmap.Format.RGBA8888, screenWidth, screenHeight, false);
pixmapregion = new TextureRegion(pixmap.getColorBufferTexture(), screenWidth, screenHeight);
pixmap.begin();
batcher.begin();
batcher.draw(image, 0, 0, screenWidth, screenHeight);
batcher.end();
pixmap.end();
batcher.begin();
batcher.draw(pixmapregion , 0, 0, screenWidth, screenHeight);
batcher.end();
Like you can see, it is little darker than image drawn directly from texture. And when I draw it with shader, the results are real mess in comparison with texture drawn with shader.
So the real question is what FrameBuffer do to texture that mess with it, so it is unusable with shader. And I need to draw it on pixmap first, so I can blend two transparent FrameBuffers. All this time I thought problem is with shader, and I lost 3 days finding what the problem is, so if someone could help me I would be very grateful! :)
Note: I tried to enable blending when drawing on FrameBuffer, to clear it first with Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); but nothing made difference.
UPDATE 2
It looks like there is something I should do with setting one kind of GL blending when drawing on FrameBuffer, and setting osecond kind of blending when drawing FrameBuffer, but I can't get the right combination yet...
OLD QUESTION
Left image is made in Photoshop, with alpha transparency, but I put black background so it can be seen better. Right image is screen shoot from android screen. This is my code, i first draw texture on pixmap, then i draw that pixmap on screen, and texture quality is very bad, and alpha channel is very distorted as you can see.
texture = new Texture("drop-blue.png");
texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
image = new TextureRegion(texture, 0, 0, 1024, 1024);
pixmap = new FrameBuffer(Pixmap.Format.RGBA8888, screenWidth, screenHeight, false);
pixmapregion = new TextureRegion(pixmap.getColorBufferTexture(), screenWidth, screenHeight);
pixmap.begin();
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batcher.begin();
batcher.draw(image, screenWidth/2 - 512, screenHeight/2 - 512, 1024, 1024);
batcher.end();
pixmap.end();
batcher.begin();
batcher.draw(pixmapregion, 0, 0, screenWidth, screenHeight);
batcher.end();