private void boxConvert(List<ModelLoader> modelList, Map<GraphicsFont, List<Text.TextInstance>> text, ContextBox box) {

		ModelLoader model = new ModelLoader();

		//put vertices
		//    0--------3
		//    |        |
		//    1--------2
		model.vertices.put((float) box.x, box.y, 0);
		model.vertices.put((float) box.x, box.y + box.height, 0);
		model.vertices.put((float) box.x + box.width, box.y + box.height, 0);
		model.vertices.put((float) box.x + box.width, box.y, 0);

		//put colors
		int color = 0;
		if (box.color != null) {
			// the bit twiddling is to convert argb to rgba
			color = box.color.getRGB() << 8 | box.color.getRGB() >>> 24;
		} else if (box.texture != null)
			color = 0xFFFFFFFF;

		model.color.add(color);
		model.color.add(color);
		model.color.add(color);
		model.color.add(color);

		//put texture and texture coords
		// 0,1-----1,1
		//  |       |
		//  |       |
		// 0,0-----1,0
		Texture t = box.texture;
		if (t != null) {
			model.texture = t;
			model.textureCoords.put(0f, t.getHeightRatio());
			model.textureCoords.put(0f, 0f);
			model.textureCoords.put(t.getWidthRatio(), 0f);
			model.textureCoords.put(t.getWidthRatio(), t.getHeightRatio());
		}

		//put indices
		model.addFace(0, 1, 2, 3);

		//put text
		if (box.texts != null) {
			for (Text textObject : box.texts) {

				List<Text.TextInstance> instances = text.get(textObject.font);

				if (instances == null)
					instances = new LinkedList<>();

				instances.addAll(textObject.instances);

				text.put(textObject.font, instances);
			}
		}

		modelList.add(model);

		if (box.subBoxes != null) {
			for (ContextBox subBox : box.subBoxes)
				boxConvert(modelList, text, subBox);
		}
	}