Let’s create a :

Now, to render anything to the framebuffer, it has to be bound (via begin() and end()):

  1. fbo.begin();
  2. Gdx.gl.glClearColor(1, 1, 1, 1);
  3. batch.draw(anyCoolSprite, 0, 0);
  4. batch.end();
  5. fbo.end();

As you can see above, the texture is flipped via use of a TextureRegion. This is done, because the framebuffer textures are generally upside-down.

If you just want to draw the framebuffer’s texture on screen, you can also use this to flip the texture:

    Hdpi

    If you’re having an hdpi display, rendering scene2d stuff inside of a framebuffer causes problems with clipping, which is used, for example, in dialogs. To fix this, either set the size of your framebuffer to the real pixel size (instead of the logical size):

    or temporarily switch the hdpi mode:

    1. HdpiUtils.setMode(HdpiMode.Pixels);
    2. fbo.begin();
    3. stage.draw();
    4. fbo.end();
    5. HdpiUtils.setMode(HdpiMode.Logical);