libgdx – How do I correctly link an OrthographicCamera to an OrthogonalTiledMapRenderer?

how to correctly link an OrthographicCamera to an OrthogonalTiledMapRenderer

How do I correctly link an OrthographicCamera to an OrthogonalTiledMapRenderer? I have a mosaic map that I would like to render and two stages that have actors in them … I call render.render () in the rendering method of my screens as well as in stage.draw (); but every time I put render.setView (camera), the screen that is displayed flashes or does other weird things. How do I properly attach a mobile camera to a mosaic map renderer? First I make the map, I do the logic of the game and then I call to draw in the stages. When I call to translate in the camera, does the tiled map move away for some reason?

here is my method of rendering

public vacuum processing (float delta) {

Gdx.gl.glClearColor (1, 0, 0, 1);
Gdx.gl.glBlendFunc (GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
Gdx.gl.glClear (GL20.GL_COLOR_BUFFER_BIT);
camera.update ();
renderer.render ();





gameLogic ();


backStage.act (); // the acts are called but do nothing


frontStage.act ();

frontStage.draw ();
backStage.draw ();

}

This is where the camera and the renderer are created.

public void addMap (map of GameMap) {

this.map = map;
maps.add (map);
renderer = new OrthogonalTiledMapRenderer (map.getTiledMap (), 1 / 20f);
camera = new OrthographicCamera (Gdx.graphics.getWidth (), Gdx.graphics.getHeight ());
floating aspect = Gdx.graphics.getWidth () / Gdx.graphics.getHeight ();
camera.setToOrtho (false, 20 * aspect, 20 * aspect);


renderer.setView (camera);
frontStage = new Stage ();
backStage = new Stage ();

xSize = map.getXSize ();
ySize = map.getYSize ();
Gdx.input.setInputProcessor (this);

}