public void draw(){
		if(currentWidth != display.getDisplayWidth() || currentHeight != display.getDisplayHeight()){
			image = new BufferedImage(display.getDisplayWidth(), display.getDisplayHeight(), BufferedImage.TYPE_INT_ARGB);
			currentWidth = display.getDisplayWidth();
			currentHeight = display.getDisplayHeight();
		}



		Graphics2D g = image.createGraphics();
		g.setColor(Color.white);
		g.fillRect(0, 0, currentWidth, currentHeight);
		Camera cam = state.getCam();
		
		//top left, top right, bottom left, bottom right
		int[] screenPos = new int[]{0,0, currentWidth,0, 0,currentHeight, currentWidth,currentHeight};
		double[] worldPos = getWorldPoints(screenPos, cam);
		
		Chunk[] map = state.getMap(
				Math.min(worldPos[0], worldPos[2]),
				Math.min(worldPos[1], worldPos[3]),
				Math.max(worldPos[4], worldPos[6]),
				Math.max(worldPos[5], worldPos[7]));

		
		//g.drawImage(block, 10, 10, 24, 24, null);
		g.setColor(Color.BLACK);
		
		double[] positions = new double[map[map.length-1].getX()-map[0].getX() * map[map.length-1].getZ()-map[0].getZ()];
		
		int p = 0;
		for(int i=0; i<map.length; i++){
			int[] h = map[i].getHeightMap();
			for(int x=0; x<map.length; x++){
				for(int z=0; z<map.length; z++){
					h[p++] = h[x+z*Chunk.CHUNK_SIZE];
				}
			}
		}
		
		int[] points = getScreenPoints(positions, cam);
		
		for(int i=0; i<points.length; i+=2)
			block.drawOnto(g, points[i], points[i+1], cam.getScale());

		display.display(image);
	}