package client.renderer.texture;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

import client.util.FileUtils;

public class SimpleTexture extends Texture {
	private final String texture;

	public SimpleTexture(String texture) {
		this.texture = texture;
	}

	public void loadTexture() throws IOException {
		this.deleteGlTexture();
		InputStream in = null;
		try {
			in = FileUtils.getResource(this.texture);
			BufferedImage img = TextureUtil.readImage(in);
			TextureUtil.uploadImage(this.getGlTextureId(), img);
		}
		finally {
			if(in != null)
				in.close();
		}
	}
}
