Libgdx Map Renderer Goes Crazy on Resize

Hi,

Currently I just have a tiledmap being rendered onto the screen (which works properly), but when I resize the window, the map keeps flashing between the old position on the screen and the new position. I think the problem has something to do with the Tiled Map Renderer, but I have no idea what the problem is.

This is being called in the resize() method of the screen:

camera.viewportWidth = width;
		camera.viewportHeight = height;
		
		camera.update();

This is in the render() method:

camera.update();
		
		level.render(camera);

This is the render method in the Level class:

public void render(OrthographicCamera camera) {
		if(mapLoaded) {
			renderer.setView(camera);
			renderer.render();
		}
	}
renderer = new OrthogonalTiledMapRenderer(map);

and

camera = new OrthographicCamera();
		camera.projection.set(camera.combined);

are called before the Level is created.