без смешивания
со смешиванием
Код для рендеринга в буфер кадра (другой класс)
Код: Выделить всё
FrameBuffer fb = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
// render to FB
fb.begin();
// clear FB
Gdx.gl.glClearColor(0, 0, 0, 0); // Clear with transparent black
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
for (Decal d : entity.groupedDecals) {
Dbatch.add(d);
}
Dbatch.flush();
fb.end();
// finish with texture
Texture textureHolder = fb.getColorBufferTexture();
texture = new TextureRegion(textureHolder);
texture.flip(false, true);
Код: Выделить всё
Sbatch.begin();
for (TextureRegion r: preRenders) {
Sbatch.draw(r, 0, 0);
}
Sbatch.end();```
Код: Выделить всё
gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
gl.glClearColor(0f, 0f, 0f, 0f);
Подробнее здесь: https://stackoverflow.com/questions/797 ... the-screen
Мобильная версия