LibGDX: take a screenshot, including ShapeRenderer

I am trying to take screenshots in my libGDX game using the code from the official wiki .

My visualization method is as follows:

Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); shapeRenderer.rect(0, 0, screenWidth, screenHeight, topColor, topColor, bottomColor, bottomColor); shapeRenderer.end(); batch.begin(); // everything else batch.end(); if (screenshot) { takeScreenshot(); } 

But unfortunately, the ShapeRenderer rectangle in the background is missing from the screenshots.

Any idea why?

+2
source share

Source: https://habr.com/ru/post/1262047/


All Articles