LibGDX Viewport not working correctly

I have a Map class, and a MapScreen class that extends the LibGDX Screen functionality. The viewport is not updating properly. When drawing a sprite, it stretches when the window is resized instead of simply seeing more of the sprite.

Map Class


public abstract class Map
{
	/** Relative to display and rendering */
	private OrthographicCamera camera;
	private ScreenViewport viewport;
	private SpriteBatch batch;
	private Box2DDebugRenderer render;
	private boolean renderDebug = true;
	
	/** Map components */
	private EntityManager entityManager;
	private RayHandler rayHandler;
	private ArrayList<MapWall> walls;
	private World world;
	
	/** Important entities */
	private Entity player;
	
	public abstract void define();
	
	public void show()
	{
		/** Create camera related objects */
		camera = new OrthographicCamera();
		viewport = new ScreenViewport(camera);
		viewport.setUnitsPerPixel(1 / 32f);
		viewport.apply();
		render = new Box2DDebugRenderer();
		batch = new SpriteBatch();
		
		/** Create map components */
		world = new World(new Vector2(0, 0), true);
		rayHandler = new RayHandler(world);
		
		walls = new ArrayList<MapWall>();
		entityManager = new EntityManager();
		
		/** Create important entities */
		player = new EntityPlayer(batch, world, camera, rayHandler);
		//entityManager.addEntity(player);
	}
	
	public void update()
	{
		world.step(1/60f, 6, 2);
		rayHandler.update();
	}

	public void render()
	{
		entityManager.render();
		rayHandler.render();
		for (MapWall w : walls) w.render();
		if (renderDebug) render.render(world, camera.combined);
		
		batch.begin();
			batch.draw(new Texture(Gdx.files.internal("wood.png")), 10, 10);
		batch.end();
	}
	
	public void dispose()
	{
		
	}

        /* ... redacted code ... */

}

MapScreen Class


package com.elsealabs.ghostr;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;

public class MapScreen extends ScreenObject {
	
	private Map map;

	public MapScreen(GameObject game, String name) {
		super(game, name);
	}
	
	public void show()
	{
		map.show();
		resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	}

	@Override
	public void render(float delta) {
		
		map.update();
		
		Gdx.gl.glClearColor(1, 0, 0, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		
		map.render();
		if (map.isRenderDebug()) map.getRender().render(map.getWorld(), map.getCamera().combined);
	}

	@Override
	public void resize(int width, int height) {
		map.getViewport().update(width, height);
	}
	
	@Override
	public void dispose() {
		map.dispose();
	}

	public void pause() { }
	public void resume() { }
	public void hide() { }
	
	/** Getters and setters */
	
	public Map getMap() {
		return map;
	}

	public void setMap(Map map) {
		this.map = map;
	}
	
}

I got it, with some help from LiquidNitrogen over the IRC.

I was not setting the projection matrix of the sprite batch.

batch.setProjectionMatrix(camera.combined);

What the hell is happening here? lol

if (map.isRenderDebug()) map.getRender().render(map.getWorld(), map.getCamera().combined);

if (map.isRenderDebug())
If the specific map is set to render the debug visuals

map.getRender()
get the debug renderer for the specific map

.render(…)
Fire the debug renderer’s render method, which has two arguments…

(map.getWorld(), …)
the box2d world of the specific map

and…

(…, map.getCamera().combined)
The projection matrix (from the map’s camera in this case) to use when rendering debug visuals.

Oh right is inline, was hard to read lol