public static HashMap<String, Material> s_readMaterials(GL gl, String resource, ResourceLocator locator) throws IOException {
		HashMap<String, Material> mats = new HashMap<String, Material>();
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(locator.getResource(resource)));
		
		Material current = null;
		
		String line;
		while ((line = reader.readLine()) != null) {
			if (line.startsWith("newmtl ")) {
				if (current != null) current.ready(gl);
				String name = line.substring(7);
				current = s_newMTL(gl);
				current.setName(name);
				mats.put(name, current);
			} else if (line.startsWith("Ka ")) {
				current.setColor("ambientColor", s_parseColor(line.substring(3)));
			} else if (line.startsWith("Kd ")) {
				current.setColor("diffuseColor", s_parseColor(line.substring(3)));
			} else if (line.startsWith("Ks ")) {
				current.setColor("specularColor", s_parseColor(line.substring(3)));
			} else if (line.startsWith("map_Kd ")) {
				String texLoc = line.substring(7);
				String parent = ResourceUtils.s_getParentDirectory(resource);
				String texResource = parent + texLoc;
				Texture2D tex = TextureFactory.s_loadTexture(gl.getGL1(), texResource, locator);
				tex.setSWrapMode(TextureWrapMode.REPEAT);
				tex.setTWrapMode(TextureWrapMode.REPEAT);
				tex.bind(gl.getGL1());
				tex.loadParams(gl.getGL1());
				tex.unbind(gl.getGL1());
				current.setTexture2D("diffuseMap", tex);
			}
		}
		if (current != null) current.ready(gl);
		return mats;
	}