So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the TextureRegions originate from the same Texture object/file but as soon as I try to combine TextureRegions with different textures of origin, only the TextureRegions from one texture file are drawn. The TextureRegions with different textures of origin do not get drawn.
For example I have two textures:
Texture tex1 = new Texture(path to texture 1);
Texture tex2 = new Texture(path to texture 2);
TextureRegion reg1a = new TextureRegion(region from tex1);
TextureRegion reg2a = new TextureRegion(region from tex2);
TextureRegion reg1b = new TextureRegion(another region from tex1);
I set up my FrameBuffer like this:
buffer = new FrameBuffer(Pixmap.Format.RGBA8888, WIDTH, HEIGHT, true);
In my draw method I do the following:
buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg2a, x, y);
buffer.end();
batch.draw(buffer.getColorBufferTexture());
Using the above draw method, ONLY reg2 is drawn. reg1 does not show up at all.
buffer.begin();
batch.draw(reg1a, x, y);
buffer.end();
batch.draw(buffer.getColorBufferTexture());
Using this draw method reg1 IS drawn, so there is nothing wrong with the textures.
buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg1b, x, y);
buffer.end();
batch.draw(buffer.getColorBufferTexture());
This draw method renders BOTH reg1a and reg1b because they both come from the same Texture obect/file.
What I want to be able to do is draw to TextureRegions from different Texture objects in the same FrameBuffer and have them both show up.
I have tried having everything from one Texture in one FrameBuffer, and the other in another FrameBuffer, then drawing those two FrameBuffers into a new FrameBuffer, but that produces the same problem.
Any help would be greatly appreciated!